Given the following data frame ("freq.sp"),

 > str(freq.sp)
`data.frame':   42 obs. of  4 variables:
 $ behav  : Factor w/ 6 levels "approach","bowride",..: 1 1 1 1 1 1 1 2 
2 2 ...
 $ species: Factor w/ 7 levels "COAST_SPOT","EAST_SPINR",..: 1 2 3 4 5 6 
7 1 2 3 ...
 $ n      : int  193 194 563 357 570 369 74 194 208 633 ...
 $ pct    : num  0.725 0.340 0.252 0.381 0.072 ...

I create a trellis barchart with the following command,

barchart(pct ~ behav | species, data=freq.sp, as.table=TRUE, 
xlab="Behavior",
    ylab="Frequency", ylim=c(0,1), main="Frequencies of Behaviors",
    scales=list(x=list(rot=45)))

In this graph, I would like to include the sample sizes (the value of 
freq.sp$n corresponding to each freq.sp$pct) at the top of each bar.  I 
don't see a specific command in barchart that will allow me to do this 
and am fairly new to lattice graphics.  I've done RSiteSearches on 
keywords that I could think of, but didn't run across anything I 
recognized as useful. Any pointers on how to accomplish this would be 
greatly appreciated.  Thanks in advance.

Cheers,
eric

-- 

Eric Archer, Ph.D.
NOAA-SWFSC
8604 La Jolla Shores Dr.
La Jolla, CA 92037
858-546-7121,7003(FAX)
[EMAIL PROTECTED]


"Lighthouses are more helpful than churches."
    - Benjamin Franklin

"Cogita tute" - Think for yourself

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to