[R] Understanding lattice barchart() display

Rich Shepard rshepard at appl-ecosys.com
Tue Oct 23 23:59:49 CEST 2012


   I've a data frame with this structure:

'data.frame':	1987 obs. of  11 variables:
  $ site         : Factor w/ 24 levels "B(W)","BC-1",..: 1 1 2 2 2 1 1 1 ...
  $ sampdate     : Date, format: "2000-07-18" "2000-07-18" ...
  $ tclass       : Factor w/ 8 levels "Annelida","Arachnida",..: 1 5 5 5 5 ...
  $ torder       : Factor w/ 18 levels "Achtinedida",..: 13 5 5 10 13 5 7 ...
  $ tfamily      : Factor w/ 81 levels "","Ameletidae",..: 79 46 46 14 42 ...
  $ tgenus       : Factor w/ 206 levels "","Acentrella",..: 1 10 10 1 140 ...
  $ tspecies     : Factor w/ 60 levels "","aequalis",..: 1 1 1 1 1 1 1 ...
  $ quant        : int  22 527 22 22 11 97 333 11 108 11 ...
  $ stream       : Factor w/ 7 levels "BCrk","JCrk",..: 1 1 1 1 1 1 1 1 ...
  $ basin        : Factor w/ 2 levels "H","O": 2 2 2 2 2 2 2 2 2 2 ...

   When I create a bar chart for tclass by stream the resulting bars appear
to have multiple segments (see attached pdf) from this command:

barchart(quant ~ tclass | stream, data = benthos, main = 'Taxonomic
Classes', xlab = 'Class Name', ylab = 'Number/square meter', scales = list(x
= list(rot = 90)))

and I want to understand what the segments represent. I thought the formula
'quant ~ tclass' would produce one bar per class. I cannot find the answer
in the ?barchart help page (it may be there and I'm not seeing it) or the
Lattice book. Your help in increasing my understanding is appreciated.

TIA,

Rich
-------------- next part --------------
A non-text attachment was scrubbed...
Name: class-by-stream.pdf
Type: application/pdf
Size: 9829 bytes
Desc: 
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20121023/b149c211/attachment.pdf>


More information about the R-help mailing list