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

collate="rows" strips Date objects into numeric #5

Closed
sdanielzafar opened this issue Feb 7, 2018 · 4 comments
Closed

collate="rows" strips Date objects into numeric #5

sdanielzafar opened this issue Feb 7, 2018 · 4 comments

Comments

@sdanielzafar
Copy link

sdanielzafar commented Feb 7, 2018

library(tidyverse)
library(purrrlyr)

data("storms")

storms %>% 
    head(100) %>% 
    mutate(Date = as.Date(paste0(year, "-", month, "-", day))) %>% 
    by_row(function(.d) {select(.d, Date)}, .to = "new", .collate = "rows")

which yeilds:

# tibble [100 × 16]
   name   year month   day  hour   lat  long status              category  wind pressure ts_diameter hu_diameter Date        .row  Date
   <chr> <dbl> <dbl> <int> <dbl> <dbl> <dbl> <chr>               <ord>    <int>    <int>       <dbl>       <dbl> <date>     <int> <dbl>
 1 Amy    1975  6.00    27  0     27.5 -79.0 tropical depression -1          25     1013          NA          NA 1975-06-27     1  2003
 2 Amy    1975  6.00    27  6.00  28.5 -79.0 tropical depression -1          25     1013          NA          NA 1975-06-27     2  2003
 3 Amy    1975  6.00    27 12.0   29.5 -79.0 tropical depression -1          25     1013          NA          NA 1975-06-27     3  2003
 4 Amy    1975  6.00    27 18.0   30.5 -79.0 tropical depression -1          25     1013          NA          NA 1975-06-27     4  2003
 5 Amy    1975  6.00    28  0     31.5 -78.8 tropical depression -1          25     1012          NA          NA 1975-06-28     5  2004
 6 Amy    1975  6.00    28  6.00  32.4 -78.7 tropical depression -1          25     1012          NA          NA 1975-06-28     6  2004
 7 Amy    1975  6.00    28 12.0   33.3 -78.0 tropical depression -1          25     1011          NA          NA 1975-06-28     7  2004
 8 Amy    1975  6.00    28 18.0   34.0 -77.0 tropical depression -1          30     1006          NA          NA 1975-06-28     8  2004
 9 Amy    1975  6.00    29  0     34.4 -75.8 tropical storm      0           35     1004          NA          NA 1975-06-29     9  2005
10 Amy    1975  6.00    29  6.00  34.0 -74.8 tropical storm      0           40     1002          NA          NA 1975-06-29    10  2005
# ... with 90 more rows

but Date column should be of Date class.

@sdanielzafar sdanielzafar changed the title collate=rows strips Date objects into numeric collate="rows" strips Date objects into numeric Feb 7, 2018
@lionel-
Copy link
Collaborator

lionel- commented Nov 15, 2018

Duplicate of #3. To solve this in the general case, this would require new infrastructure that is being developed in the vctrs package. But note that while purrrlyr is still maintained, it is no longer under active development.

@lionel- lionel- closed this as completed Nov 15, 2018
@lorenzwalthert
Copy link

In this case, should a life-cycle badge be added to this repo?

@lionel-
Copy link
Collaborator

lionel- commented Nov 15, 2018

There is a lifecycle badge in the README.

@lorenzwalthert
Copy link

Sorry, was not passionate enough to wait for the full page to be loaded -.- Thanks.

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

3 participants