Comments in line

On 02/12/2014 23:27, Silong Liao wrote:
Dear ALL,

I have a dataset contains 2 variables: mate (mating groups) and ratio (ratio of 
number of mothers and fathers). And mate is an identifer which consists three 
components: year, flock (flk), and tag.

I am using command "barchart" under package "lattice" to generate plots of 
ratio against mate divided by each flock (See attachment). I want to put flock names onto the 
corresponding plots, but don't know how.

Cheers, Sid

load("ratiodata.Rdata")
attach(ratiodata)

in general it is a bad idea to use attach, use the data= parameter if available.

head(ratiodata)

         mate    ratio1 2007.102.A 21.285712 2007.102.B 68.200003 2007.102.C 
59.500004 2007.102.D 19.333335 2007.102.E 72.333336 2007.102.F 35.50000
str(ratiodata$mate) #factor
str(ratiodata$ratio) #num
unique(ratiodata$flk)

[1]  102    2 2744 2747 2749  391 4357 4880 3001 3003 3004 3855 3658 4588 4591 
4631
library("lattice")
ratiodata$flk=read.table(text=as.character(ratiodata$mate),sep=".")[,2]

So what did this give you for flk?

barchart(ratiodata$ratio~ratiodata$mate|ratiodata$flk)

This could be

barchart(ratio ~ mate | flk, data = ratiodata)

which is much easier to read.
So what did it label the panels with?



                                        
______________________________________________
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.


-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2015.0.5577 / Virus Database: 4235/8673 - Release Date: 12/03/14



--
Michael
http://www.dewey.myzen.co.uk

______________________________________________
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