I am trying to melt a data frame and I get this weird error. Any ideas why?
str(zx7)
\'data.frame\': 519 obs. of 5 variables:
$ calday.new: Date, format: \"2
I don't konw how did you create your structure, but when I do this , it works for me
zx7 <- data.frame( calday.new=seq(from = as.Date('2011-01-03'),by=1,length.out=519),
A20=ts(rep(0,519)),
B20=ts(rep(0,519)),
C20=ts(rep(0,519)),
D20=ts(rep(0,519)))
I create the same structure as above :
str(zx7)
'data.frame': 519 obs. of 5 variables:
$ calday.new: Date, format: "2011-01-03" "2011-01-04" "2011-01-05" ...
$ A20 : Time-Series from 1 to 519: 0 0 0 0 0 0 0 0 0 0 ...
$ B20 : Time-Series from 1 to 519: 0 0 0 0 0 0 0 0 0 0 ...
$ C20 : Time-Series from 1 to 519: 0 0 0 0 0 0 0 0 0 0 ...
$ D20 : Time-Series from 1 to 519: 0 0 0 0 0 0 0 0 0 0 ...
Then I melt :
head(melt(zx7, id=c("calday.new")))
calday.new variable value
1 2011-01-03 A20 0
2 2011-01-04 A20 0
3 2011-01-05 A20 0
4 2011-01-06 A20 0
5 2011-01-07 A20 0
6 2011-01-08 A20 0