I am getting an error when trying to use melt() on a dataframe containing Dates

Posted by Dan on Stack Overflow See other posts from Stack Overflow or by Dan
Published on 2010-05-14T01:29:23Z Indexed on 2010/05/14 1:34 UTC
Read the original article Hit count: 433

Filed under:
|
|

I'd like to melt the dataframe so that in one column i have dates in a second i have username as the variable and finally the value.

I'm getting this error:

Error in as.Date.numeric(value) : 'origin' must be supplied

and while I understand the error I'm not exactly sure how to get around it.

A small sample of the data is:

structure(list(created_at = structure(c(14007, 14008, 14009, 
14010, 14011, 14012), class = "Date"), benjamin = c(16, 0, 0, 
0, 0, 0), byron = c(0, 0, 0, 0, 0, 0), cameronc = c(0, 0, 0, 
0, 0, 0), daniel = c(0, 0, 0, 0, 0, 0), djdiaz = c(0, 0, 0, 0, 
0, 0), gene = c(16, 77, 64, 38, 72, 36), joel = c(0, 0, 0, 0, 
0, 2), kerem = c(0, 0, 0, 0, 0, 0), sophia = c(0, 0, 0, 0, 0, 
0), SuperMoonMan = c(0, 0, 0, 0, 0, 0)), .Names = c("created_at", 
"benjamin", "byron", "cameronc", "daniel", "djdiaz", "gene", 
"joel", "kerem", "sophia", "SuperMoonMan"), row.names = c(NA, 
6L), class = c("cast_df", "data.frame"))

Thanks for your help.

© Stack Overflow or respective owner

Related posts about r

    Related posts about reshape