[R] transpose a data frame according to a specific variable
Erich Neuwirth
erich.neuwirth at univie.ac.at
Mon Feb 9 19:27:51 CET 2015
library(tidyr)
spread(DF,Year,Day)
> On 09 Feb 2015, at 16:47, jeff6868 <geoffrey_klein at etu.u-bourgogne.fr> wrote:
>
> finalDF <-
> data.frame(id=c("A","B","C"),"2000"=c(NA,NA,164),"2001"=c(120,NA,99),
> "2002"=c(90,18,48),"2003"=c(54,217,NA),"2004"=c(NA,68,NA))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 670 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20150209/c8d279c3/attachment.bin>
More information about the R-help
mailing list