On Jan 20, 2010, at 11:07 AM, BioStudent wrote:
Hi
I'm hoping someone can help me I am a relative newbie to R.
I have data that is in a similar format to this...
Experiment Score1 Score2
X -0.85 -0.02
X -1.21 -0.02
X 1.05 0.09
Y -1.12 -0.07
Y -0.27 -0.07
Y -0.93 -0.08
Z 1.1 -0.03
Z 2.4 0.09
Z -1.0 0.09
Now I can easily have a look at the overall correlation of score 1
and 2 by
doing this
plot(data[,2], data[,3]) or
fit <- lm(data[,2] ~ data[,3]
BUT! I really want to look at the correlations within each
experiment type
so ideally a multiple plot per page of each correlation within an
experiment
- and/or a way of looping through the data to get the simple linear
regression for each experiment for scores 1 and 2. This looks like
an easy
example but I have thousands of results so it would be really hand
to find
away of doing this quickly!!
library(lattice)
?xyplot # a group specification
?panel.lmline
There are quite a few examples at the xyplot help page.
--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
______________________________________________
R-help@r-project.org mailing list
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.