[R] Mutliple sets of data in one dataset....Need a loop?
Matthew Dowle
mdowle at mdowle.plus.com
Thu Jan 21 19:44:24 CET 2010
> but I have thousands of results so it would be really hand to find away of
> doing this quickly
> its a little difficult to follow those examples
Given your data in data.frame DF, maybe add the following to your list to
investigate :
> dat = data.table(DF)
> dat[, cor(Score1,Score2), by="Experiment"]
Experiment V1
[1,] X 0.9889524
[2,] Y 0.3041195
[3,] Z -0.1346107
To do a plot instead just replace "cor" with "plot" or whatever else you
want to do within each group.
Since you said you have thousands of results, data.table is faster for
that.
In terms of ease of use, you could try plyr too, which you may well
prefer.
> those examples as all seem so different
If you look and search crantastic, users are putting their comments there.
That might help you make a decision more quickly and avoid you needing to
post to r-help and wait for a reply, assuming there is a package that
already does what you need. Searching the history of r-help would have found
many solutions to your problem this time, but it seems you are looking for
advice on the best way. This changes over time and depends on lots of
factors, including what you really want to do. Once you have worked out
which packages work best for you, put your votes/comments onto crantastic
and it should help everyone who follows in your path. I guess you should
then update your votes/comments as time progresses too.
Btw, plyr is ranked #2 on crantastic and is designed specifically for your
task !! Making yourself aware of the most popular packages would have
helped you. If you need speed try data.table. When it comes to current,
up to date advice on the most appropriate package, crantastic could be
fantastic, assuming of course that you, the user, contributes to it.
HTH
"BioStudent" <s0975764 at sms.ed.ac.uk> wrote in message
news:1264072645590-1049653.post at n4.nabble.com...
>
> Hi Thanks for all your help
>
> Its a little difficult to follow those examples as all seem so different
> and
> its hard to see how I do what I want to my data from the help files but
> i'll
> try...
> --
> View this message in context:
> http://n4.nabble.com/Mutliple-sets-of-data-in-one-dataset-Need-a-loop-tp1018503p1049653.html
> Sent from the R help mailing list archive at Nabble.com.
>
More information about the R-help
mailing list