Nothing
Code
(expect_error(unnest(df, y)))
Output
<error/vctrs_error_scalar_type>
Error in `list_sizes()`:
! `x[[1]]` must be a vector, not a function.
Code
(expect_error(unnest(df, c(x, y))))
Output
<error/rlang_error>
Error in `unnest()`:
! In row 1, can't recycle input of size 2 to size 3.
Code
(expect_error(unnest(df, c(x, y))))
Output
<error/rlang_error>
Error in `unnest()`:
! In row 1, can't recycle input of size 2 to size 3.
Code
(expect_error(unnest(df, x)))
Output
<error/vctrs_error_ptype2>
Error in `list_unchop()`:
! Can't combine `x[[1]]` <double> and `x[[2]]` <tbl_df>.
Code
unnest(df, y)
Condition
Error in `unnest()`:
! Can't duplicate names between the affected columns and the original data.
x These names are duplicated:
i `x`, from `y`.
i Use `names_sep` to disambiguate using the column name.
i Or use `names_repair` to specify a repair strategy.
Code
unnest(df, c(x, y))
Condition
Error in `unnest()`:
! Can't duplicate names within the affected columns.
x These names are duplicated:
i `a`, within `x` and `y`.
i Use `names_sep` to disambiguate using the column name.
i Or use `names_repair` to specify a repair strategy.
Code
unnest(df, c(y = x))
Condition
Error in `unnest()`:
! Can't rename variables in this context.
Code
unnest(df, x, y)
Condition
Warning:
`unnest()` has a new interface. See `?unnest` for details.
i Try `df %>% unnest(c(x, y))`, with `mutate()` if needed.
Output
# A tibble: 2 x 2
x y
<dbl> <chr>
1 3 a
2 4 b
Code
unnest(df)
Condition
Warning:
`cols` is now required when using `unnest()`.
i Please use `cols = c(y)`.
Output
# A tibble: 2 x 2
x y
<int> <chr>
1 1 a
2 2 b
Code
out <- df %>% unnest(c(x, y), .sep = "_")
Condition
Warning:
The `.sep` argument of `unnest()` is deprecated as of tidyr 1.0.0.
i Use `names_sep = '_'` instead.
Code
out <- df %>% unnest(z = map(y, `+`, 1))
Condition
Warning:
`unnest()` has a new interface. See `?unnest` for details.
i Try `df %>% unnest(c(z))`, with `mutate()` if needed.
Code
df %>% unnest(x, .preserve = y)
Condition
Warning:
The `.preserve` argument of `unnest()` is deprecated as of tidyr 1.0.0.
i All list-columns are now preserved
Output
# A tibble: 2 x 2
x y
<dbl> <list>
1 3 <chr [1]>
2 4 <chr [1]>
Code
df %>% unnest(x, .drop = FALSE)
Condition
Warning:
The `.drop` argument of `unnest()` is deprecated as of tidyr 1.0.0.
i All list-columns are now preserved.
Output
# A tibble: 2 x 2
x y
<dbl> <list>
1 3 <chr [1]>
2 4 <chr [1]>
Code
out <- unnest(df, y, .id = "name")
Condition
Warning:
The `.id` argument of `unnest()` is deprecated as of tidyr 1.0.0.
i Manually create column of names instead.
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.