(I know that you said your post may already be "out of date", but ...)

"   Despite additional reading of barchart() examples and help pages I'm
still
missing how to get grouping working and use the years in the dataframe as
labels on the x-axis."

But ?barchart says:
"Formally, if groups is specified, then groups along with subscripts is
passed to the panel function, ..."

which, as I already told you, means you should consult ?panel.barchart . In
particular, the example therein tells you exactly how the "groups" argument
should be specified and how it works (you can change colors via the "col"
argument, of course). Note, in particular, that "groups" must be your
grouping variable, which means, in particular, that you need to reformat
your data frame in what is currently referred to as "tidy" format (aka
"long" format as opposed to "wide") -- one variable per column, one
observation per row.  That is:

Year     Value   Summary.Type
1991    91.24   "Med"
1991    92.89   "Max"
... etc.

.... groups = Summary.Type, ...
in your call will then do the job.

As an aside, this is a good example of why you should adhere to this format
for data analysis in R.

Cheers,
Bert






Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Aug 22, 2018 at 10:34 AM Rich Shepard <rshep...@appl-ecosys.com>
wrote:

> On Wed, 22 Aug 2018, Rich Shepard wrote:
>
> > Correcting the barchard() command fixed the main issue; getting the
> second
> > set of bars is still eluding me, but I'll continue working on fixing
> this.
> > I'll get the years as the x-axis labels rather than year number in
> > sequence from 1 to 29.
>
>    Despite additional reading of barchart() examples and help pages I'm
> still
> missing how to get grouping working and use the years in the dataframe as
> labels on the x-axis.
>
>    The most recent command version (on the dput output in my previous
> message) is:
>
> med_max <- barchart(stage_heights$Med ~ stage_heights$Year,
> horizontal=FALSE, col = 'black',
>                      main = 'Median and Maximum Stage Heights\nUSGS Gauge',
>                      ylab = 'Elevation (masl)', xlab = 'Year', groups=TRUE,
>                      beside=TRUE, panel = "panel.superbar", prepanel =
> "prepanel.superbar",)
> print(med_max)
>
>    I don't think that conditioning into a trellis applies to this barchart
> and I'm not relating the use of scales and labels in a conditioned plot to
> the barchart.
>
>    The above command yields an error and I've not found the explanation for
> it:
>
> Error in get(fun, mode = "function", envir = parent.frame()) :
>    object 'panel.superbar' of mode 'function' was not found
>
> so I'm definitely not getting the command syntax correct. Help's still
> needed.
>
> Rich
>
> ______________________________________________
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to