Hi, is there a good way (instead of a time-consuming for loop) to
transfer a key/value pair dataframe to a dataframe with key as column
and value as row?  For example, I have a dataframe with three columns:
id, code, value:
 
id,code,value
1,hi,10.3
1,lo,5.2
2,hi,19.4
3,hi,20
3,lo,12
4,lo,5.8
 
I want to get a dataframe like this:
 
id,hi,lo
1,10.3,5.2
2,19.4,NA
3,20,12
4,NA,5.8
 
Thank you,
Richard

        [[alternative HTML version deleted]]

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

Reply via email to