-
Notifications
You must be signed in to change notification settings - Fork 129
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
Failure to print a tibble with an S4 column #358
Comments
I posted a superset of the following on StackOverflow in trying to get to the bottom of this issue (https://stackoverflow.com/questions/48087358/tibbles-reject-lubridates-duration-and-period-objects). It may be useful - and the reprexes (reprices?) are more minimal. The following code successfully produces a
However, when I try to print
Replacing
Using
Digging in the source code, I find the following chain of dependencies that give the same error message: In
The objects have a structure, but trying to print them yields an error.
Consequently, it appears that assigning the class of the Furthermore, given that Package versions
|
Thanks for the analysis. It looks like creating the tibble succeeds, only printing fails: x <- tibble::tibble(y = lubridate::as.duration(1))
print(x)
## Error: ... The source of the error seems to be the x <- pillar::pillar(lubridate::as.duration(1))
#> Error: Incompatible duration classes (Duration, numeric). Please coerce with `as.duration`.
Closing in favor of r-lib/pillar#88. |
Hi, library(tidyverse)
#> -- Attaching packages -------------------------------------------------------------------------------------------------------------------- tidyverse 1.2.1 --
#> v ggplot2 2.2.1 v purrr 0.2.4
#> v tibble 1.4.2 v dplyr 0.7.4
#> v tidyr 0.7.2 v stringr 1.2.0
#> v readr 1.1.1 v forcats 0.2.0
#> -- Conflicts ----------------------------------------------------------------------------------------------------------------------- tidyverse_conflicts() --
#> x dplyr::filter() masks stats::filter()
#> x dplyr::lag() masks stats::lag()
library(lubridate)
#>
#> Attache Paket: 'lubridate'
#> The following object is masked from 'package:base':
#>
#> date
df <- data.frame(begin = c(ymd_hm("2018-01-01 00:00"),
ymd_hm("1900-01-01 00:00"),
ymd_hm("1900-01-01 00:00")),
end = c(ymd_hm("2018-01-04 00:00"),
ymd_hm("3000-01-01 00:00"),
ymd_hm("3000-12-31 00:00")))
df %>% mutate(test = interval(start=begin, end=end))
#> begin end
#> 1 2018-01-01 01:00:00 2018-01-04 01:00:00
#> 2 1900-01-01 01:00:00 3000-01-01 01:00:00
#> 3 1900-01-01 01:00:00 3000-12-31 01:00:00
#> test
#> 1 2018-01-01 01:00:00 CET--2018-01-04 01:00:00 CET
#> 2 1900-01-01 01:00:00 CET--3000-01-01 01:00:00 CET
#> 3 1900-01-01 01:00:00 CET--3000-12-31 01:00:00 CET
df <- tibble(begin = c(ymd_hm("2018-01-01 00:00"),
ymd_hm("1900-01-01 00:00"),
ymd_hm("1900-01-01 00:00")),
end = c(ymd_hm("2018-01-04 00:00"),
ymd_hm("3000-01-01 00:00"),
ymd_hm("3000-12-31 00:00")))
df %>% mutate(test = interval(start=begin, end=end))
#> 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. |
The following code yields the same error, so your error is also due to the pillar bug:
|
Printing S4 objects should work with the latest version of pillar. |
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary. |
When I want to
print
a tibble containing an S4 column, I get an error with tibble 1.4.1 as well as with the current GitHub version, but not with version 1.3.4.The text was updated successfully, but these errors were encountered: