Hi R,

 

Can I transpose a data frame by a particular group variable?

 

For example:

d=data.frame(group=c(1,1,2,2,2),val=c(6,4,6,3,5))

And my output should be:

data.frame(group=c(1,2),v1=c(6,6),v2=c(4,3),v3=c(NA,5))

 

Many thanks,

Shubha

This e-mail may contain confidential and/or privileged i...{{dropped:13}}

______________________________________________
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