Reputation: 392
I have a list like this, https://i.sstatic.net/aLT1L.png I want the list to be a character vectors not a list of list with values as tibbles how do I convert the whole list? I need to retain the grouping. I did groupsplit to get to where I am in dplyr
f.vars.h1.list<-f.vars.to.agg.1h%>%
group_split(ActivityGroup, keep = FALSE)
$`Fans`
[2] "Shea""Fenway"
[4] "Mets" "Eagles"
$`Spicy`
character(0)
$`Trays`
[2] "Yankeess"
[4] "Wildcard" "Patriots"
[7] "teams"
Upvotes: 0
Views: 52
Reputation: 389175
What is the other column from where you want to split the values in f.vars.to.agg.1h
called? For simplicity assuming here it is called as col
you could use base::split
.
f.vars.h1.list <- split(f.vars.to.agg.1h$col, f.vars.to.agg.1h$ActivityGroup)
If you want to continue using tidyverse
group_split
always returns a tibble you can unlist
the output :
library(dplyr)
library(purrr)
f.vars.h1.list <- f.vars.to.agg.1h %>%
group_split(ActivityGroup, keep = FALSE) %>%
map(unlist)
Upvotes: 1