I have a list like this:
require(tidyverse)
months <- c("january", "february", "march", "october", "december")
weekdays <- c("Sunday", "Monday", "Tuesday")
seasons <- c("Summer", "Winter", "Fall", "autumn")
timeWords_list <- tibble::lst(months, weekdays, seasons)
I want to convert this list into a two columns-data.frame: I need all the values of the list to be in the first column And the tags to be the values of the second column
The result should be like this:
df <- data.frame(first_column = c("january", "february", "march", "october", "december", "Sunday", "Monday", "Tuesday", "Summer", "Winter", "Fall", "autumn"),
second_column = c("months", "months", "months", "months", "months", "weekdays", "weekdays" ,"weekdays", "seasons", "seasons", "seasons", "seasons"))
The second column could be a string or a factor, but should correspond to tags of the list. Note that the list could be of different sizes and its elements could have different lengths.