You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently found what I thought was a bug but is apparently a feature where mutate (and perhaps more dplyr functions) do not support POSIXlt in columns. I think that I understand why due to POSIXlt being a list of vectors rather than a class more like a vector (while reading through prior issues here, that seems to be the case).
library(dplyr)
#> Warning: package 'dplyr' was built under R version 3.4.4#> #> Attaching package: 'dplyr'#> The following objects are masked from 'package:stats':#> #> filter, lag#> The following objects are masked from 'package:base':#> #> intersect, setdiff, setequal, unionmy_data<-data.frame(A=1, B=c(40000.5, NA))
my_data %>%
mutate(B=as.POSIXlt(B, origin="2018-01-01"))
#> Warning: package 'bindrcpp' was built under R version 3.4.4#> Error in mutate_impl(.data, dots): Column `B` is of unsupported class POSIXltmy_data %>%
mutate(B=as.POSIXct(B, origin="2018-01-01"))
#> A B#> 1 1 2018-01-01 06:06:40#> 2 1 <NA>
Since POXIXlt is not supported, but POSIXct is, could POSIXlt columns be automatically converted to POSIXct with a warning rather than the less-usable error of "Column B is of unsupported class POSIXlt" (which doesn't give any hints about why it is unsupported or what to do to make a column supported).
The text was updated successfully, but these errors were encountered:
It makes sense that auto-conversion in those places would be brittle changes.
Could the errors be made more directive? Rather than just saying “POSIXlt not supported” (and similar), could thy say “POSIXlt not supported, try converting to POSIXct.”? That could give the user a hint of how to solve the problem.
This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/
lockbot
locked and limited conversation to collaborators
Nov 24, 2019
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I recently found what I thought was a bug but is apparently a feature where
mutate
(and perhaps moredplyr
functions) do not supportPOSIXlt
in columns. I think that I understand why due to POSIXlt being a list of vectors rather than a class more like a vector (while reading through prior issues here, that seems to be the case).Since POXIXlt is not supported, but POSIXct is, could POSIXlt columns be automatically converted to POSIXct with a warning rather than the less-usable error of "Column
B
is of unsupported class POSIXlt" (which doesn't give any hints about why it is unsupported or what to do to make a column supported).The text was updated successfully, but these errors were encountered: