Displaying 1 result from an estimated 1 matches for "nestsplit".
Did you mean:
xbestsplit
2024 Apr 18
1
Tidyverse/dplyr solution for filling values of a tibble/dataframe from a column with a nested list.
...l_5?
Which I have done with the following:
tibble[paste0("col_", 1:5)] <- 0
?And then replace each 0 with the value (second number in the nested list), based on the index (first number in each nested list), for each row of the tibble.
I wrote a function to split each nested list:
nestsplit <- function(x, y) {?
`unlist(lapply(x, [[`, y))?
}?
And then generate unique columns with the column names (by index) and values of interest to append to the tibble?:
tibble <-?
tibble |> rowwise() |> mutate(index_names = list(paste0(?
"col_", as.character(n...