[R] lattice barchart() with two variables

Rich Shepard r@hep@rd @end|ng |rom @pp|-eco@y@@com
Wed Aug 22 19:24:01 CEST 2018


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




More information about the R-help mailing list