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 am not sure if this is due to lubridate or dplyr, but currently having a column be of interval type in a tibble or data frame causes many dplyr operations to break with a somewhat uninformative error. I think I have everything up to date, but session info included regardless.
Setup and some example data:
library(tidyverse)
library(lubridate)
#> #> Attaching package: 'lubridate'#> The following object is masked from 'package:base':#> #> datetbl<- tibble(
x=1:10,
start= seq(
from= ymd_hms("2018-01-01 12:00:00"),
to= ymd_hms("2018-02-01 12:00:00"),
length=10
),
end= seq(
from= ymd_hms("2018-01-01 15:00:00"),
to= ymd_hms("2018-02-01 15:00:00"),
length=10
),
interval=start %--% end
)
Now we can try a variety of simple dplyr actions that I would expect to work, but fail for some reason to do with the interval column. The error message is not particularly illuminating as to where in the process things are going wrong.
tbl %>% mutate(y=1:10)
#> Note: method with signature 'Interval#ANY' chosen for function '-',#> target signature 'Interval#Interval'.#> "ANY#Interval" would also be valid#> Error in round_x - lhs: Arithmetic operators undefined for 'Interval' and 'Interval' classes:#> convert one to numeric or a matching time-span class.tbl %>% select(everything())
#> Error in round_x - lhs: Arithmetic operators undefined for 'Interval' and 'Interval' classes:#> convert one to numeric or a matching time-span class.tbl %>% arrange(end)
#> Error in round_x - lhs: Arithmetic operators undefined for 'Interval' and 'Interval' classes:#> convert one to numeric or a matching time-span class.tbl %>% filter(x>5)
#> Error in round_x - lhs: Arithmetic operators undefined for 'Interval' and 'Interval' classes:#> convert one to numeric or a matching time-span class.
Note that one verb that does work is removing the interval column, and once it is gone all the above verbs work as expected:
I am not sure if this is due to
lubridate
ordplyr
, but currently having a column be ofinterval
type in a tibble or data frame causes many dplyr operations to break with a somewhat uninformative error. I think I have everything up to date, but session info included regardless.Setup and some example data:
Now we can try a variety of simple
dplyr
actions that I would expect to work, but fail for some reason to do with theinterval
column. The error message is not particularly illuminating as to where in the process things are going wrong.Note that one verb that does work is removing the
interval
column, and once it is gone all the above verbs work as expected:Created on 2018-02-08 by the reprex package (v0.2.0).
Session info
The text was updated successfully, but these errors were encountered: