unnest_fun | R Documentation |
Implement similar functions to the tidyr::unnest function.
unnest_fun(data, cols, keep_empty = FALSE)
data |
A data frame. |
cols |
Columns to unnest. |
keep_empty |
By default, you get one row of output for each element of the list your unchopping/unnesting.
This means that if there's a size-0 element (like |
data <- data.frame(
id = 1:3,
x = c("a", "b", "c"),
stringsAsFactors = FALSE
)
data$data <- list(
c(1, 2),
c(3, 4, 5),
c(6)
)
unnest_fun(data, cols = "data")
data2 <- data.frame(
id = 1:3,
x = c("a", "b", "c"),
stringsAsFactors = FALSE
)
data2$data <- list(
c(1, 2),
numeric(0),
c(6)
)
unnest_fun(data2, cols = "data")
unnest_fun(data2, cols = "data", keep_empty = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.