-
Notifications
You must be signed in to change notification settings - Fork 418
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
Problem with Nest leading to r error 4 (R code execution error) #654
Comments
Adding the relevant warning from library(dplyr)
library(tidyr)
iris2 <- as_tibble(iris) %>% nest(-Species)
#> Warning: All elements of `...` must be named.
#> Did you want `data = c(Sepal.Length, Sepal.Width, Petal.Length, Petal.Width)`?
View(iris2)
#> Error: Can't cast `x` <list_of<
#> tbl_df<
#> Sepal.Length: double
#> Sepal.Width : double
#> Petal.Length: double
#> Petal.Width : double
#> >
#> >> to `to` <character>. backtrace <error>
message: Can't cast `x` <list_of<
tbl_df<
Sepal.Length: double
Sepal.Width : double
Petal.Length: double
Petal.Width : double
>
>> to `to` <character>.
class: `vctrs_error_incompatible_cast`
backtrace:
1. (function (x, start, len, ...) ...
7. vctrs:::vec_cast.character.default(...)
8. vctrs::vec_default_cast(x, to, x_arg = x_arg, to_arg = to_arg)
9. vctrs::stop_incompatible_cast(x, to, x_arg = x_arg, to_arg = to_arg)
10. vctrs:::stop_incompatible(...)
11. vctrs:::stop_vctrs(...) |
There doesn't seem to be a reasonable way of implementing |
Thinking more about it, I think this default method for #' @export
as.character.vctrs_list_of <- function(x, ...) {
map_chr(x, as_label)
} This gives: WDYT @hadley? |
Would it be better to return |
I think it's generally better to return a single-line string per row from |
We could use |
Sounds good! |
I've been getting an error message when using
nest
. Let's use the example from the documentation.If I assign this to an object and go to view, I get the following error message "r error 4 (R code execution error)".
The text was updated successfully, but these errors were encountered: