Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gather turns date column into integer #107

Closed
dncnbrn opened this issue Sep 10, 2015 · 1 comment
Closed

Gather turns date column into integer #107

dncnbrn opened this issue Sep 10, 2015 · 1 comment

Comments

@dncnbrn
Copy link

dncnbrn commented Sep 10, 2015

I'm sure this hasn't been a problem before now, but when I use gather on a data frame which has a date column (NB: the date column isn't being gathered into key/value), it changes the dates to integers. Here's a minimum example:

library(tidyr)

data.frame(x=rnorm(10),y=rnorm(10),date=seq.Date(as.Date("2005-01-01"),,by=1,length.out=10)) %>%
  gather(a, key,value,x,y)

And here's the first five rows of output:

date   key       value

12784 x 1.16951115
12785 x -0.65827450
12786 x -0.33643075
12787 x -0.94782685
12788 x -0.44513446

Here's my session info:


R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252    LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] tidyr_0.3.0

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.0      assertthat_0.1   dplyr_0.4.3      digest_0.6.8     MASS_7.3-44      R6_2.1.1         grid_3.2.2       plyr_1.8.3       DBI_0.3.1       
[10] gtable_0.1.2     magrittr_1.5     scales_0.3.0     ggplot2_1.0.1    stringi_0.5-5    lazyeval_0.1.10  reshape2_1.4.1   ggthemes_2.2.1   proto_0.3-10    
[19] tools_3.2.2      stringr_1.0.0    munsell_0.4.2    parallel_3.2.2   colorspace_1.2-6

Any help gratefully received.

@hadley
Copy link
Member

hadley commented Sep 10, 2015

Duplicate of #104 - Already fixed in dev version and on its way to CRAN.

@hadley hadley closed this as completed Sep 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants