I'm trying to find a clever way to re-map data from a database
query into a data.frame.

Querying a database often returns a table (data.frame) like this:

GeneID   MethodID   Value
6        1          123
6        2          456
6        3          987
7        1          234
7        3          432
8        2          190
8        3          34
8        1          864     

Note that GeneID=7 doesn't have a value for MethodID=2.

Note that GeneID=8 doesn't have the MethodID in any particular order
and, in fact, there doesn't need to be an order to the GeneID, although
I can force ordering as part of my SQL query.

I want to reformat this into a data.frame with multiple columns:

       Value       Value     Value
GeneID Method1     Method2   Method3
6      123         456       987
7      234         NA        432
8      864         190       34

Is there an elegant way to do this type of reformating in R?

Thanks.
Mark

-- 
Mark Dalphin                          email: [EMAIL PROTECTED]
Mail Stop: 29-2-A                     phone: +1-805-447-4951 (work)
One Amgen Center Drive                       +1-805-375-0680 (home)
Thousand Oaks, CA 91320                 fax: +1-805-499-9955 (work)

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to