I would like to have a list where each item is "Born in " each of the cities of the cities vector.
cities <- c("Lausanne", "Zurich", "Geneva")
mylist <- list()
for (i in 1:length(cities)){
for (city in cities){
born <- paste0("Born in ", city)
mylist[[i]] <- born
}
}
I need it in the list format because I have much more complex data and would actually be adding dataframes into the list. I would like to understand how the double loop would work (one for items and one for length).
Thank you!