{"action":"closed","issue":{"url":"https://api.github.com/repos/tidyverse/purrr/issues/499","repository_url":"https://api.github.com/repos/tidyverse/purrr","labels_url":"https://api.github.com/repos/tidyverse/purrr/issues/499/labels{/name}","comments_url":"https://api.github.com/repos/tidyverse/purrr/issues/499/comments","events_url":"https://api.github.com/repos/tidyverse/purrr/issues/499/events","html_url":"https://github.com/tidyverse/purrr/issues/499","id":319175485,"number":499,"title":"FR: map_date and map_datetime versions","user":{"login":"czeildi","id":9638790,"avatar_url":"https://avatars3.githubusercontent.com/u/9638790?v=4","gravatar_id":"","url":"https://api.github.com/users/czeildi","html_url":"https://github.com/czeildi","followers_url":"https://api.github.com/users/czeildi/followers","following_url":"https://api.github.com/users/czeildi/following{/other_user}","gists_url":"https://api.github.com/users/czeildi/gists{/gist_id}","starred_url":"https://api.github.com/users/czeildi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/czeildi/subscriptions","organizations_url":"https://api.github.com/users/czeildi/orgs","repos_url":"https://api.github.com/users/czeildi/repos","events_url":"https://api.github.com/users/czeildi/events{/privacy}","received_events_url":"https://api.github.com/users/czeildi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-05-01T11:25:14Z","updated_at":"2018-05-05T16:34:23Z","closed_at":"2018-05-05T16:34:22Z","author_association":"NONE","body":"I'd love to see a `map_date` and `map_datetime` functions. My use case: there are some non-vectorized datetime related functions, e.g. `lubridate::with_tz` and I need map to create a new column with them in a data frame. I only found a workaround to arrive at a plain datetime column.\r\n\r\n``` r\r\nlibrary(purrr)\r\nlibrary(lubridate)\r\nlibrary(tibble)\r\nlibrary(dplyr)\r\n\r\ndf <- tibble(\r\n  dttm_orig = ymd_hms(c(\"2018-04-01 08:00:00\", \"2017-03-02 03:00:00\")),\r\n  tz = c(\"UTC\", \"CET\"),\r\n  sales_amount = c(34, 56)\r\n)\r\n\r\nmutate(df, purchase_time = map2(dttm_orig, tz, ~with_tz(.x, .y)))\r\n#> # A tibble: 2 x 4\r\n#>   dttm_orig           tz    sales_amount purchase_time\r\n#>   <dttm>              <chr>        <dbl> <list>       \r\n#> 1 2018-04-01 08:00:00 UTC           34.0 <dttm [1]>   \r\n#> 2 2017-03-02 03:00:00 CET           56.0 <dttm [1]>\r\n\r\nmutate(df, purchase_time = map2_chr(dttm_orig, tz, ~as.character(with_tz(.x, .y))) %>% ymd_hms())\r\n#> # A tibble: 2 x 4\r\n#>   dttm_orig           tz    sales_amount purchase_time      \r\n#>   <dttm>              <chr>        <dbl> <dttm>             \r\n#> 1 2018-04-01 08:00:00 UTC           34.0 2018-04-01 08:00:00\r\n#> 2 2017-03-02 03:00:00 CET           56.0 2017-03-02 04:00:00\r\n```\r\n\r\nCreated on 2018-05-01 by the [reprex package](http://reprex.tidyverse.org) (v0.2.0).\r\n\r\nRelated: \r\n#358 "}}
{"actor":{"display_login":"hadley"}}