[R] Mutliple sets of data in one dataset....Need a loop?
BioStudent
s0975764 at sms.ed.ac.uk
Wed Jan 20 17:07:57 CET 2010
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!!
Let me know if you need more explaining...
E
--
View this message in context: http://n4.nabble.com/Mutliple-sets-of-data-in-one-dataset-Need-a-loop-tp1018503p1018503.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list