Created
January 23, 2013 10:08
-
-
Save krlmlr/4603945 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dat <- read.table(text="VARIABLES DATE DATA | |
V1 1/03/2012 1000 | |
V1 1/04/2012 1500 | |
V1 1/12/2012 2600 | |
V2 1/03/2012 900 | |
V2 1/04/2012 1200 | |
V2 1/12/2012 1000 | |
V3 1/03/2012 200", header = TRUE) | |
library(reshape) | |
dat.m <- melt(dat, id.vars=c('VARIABLES', 'DATE')) | |
head(dat.m) | |
dat.c <- as.data.frame(cast(dat.m, VARIABLES~DATE+.)) | |
head(dat.c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment