mydata <- data.frame(country = rep(c("NL", "BE"), 2), value = 9:12)
library(data.table)
setDT(mydata)
# split by country, create a named list
L <- split(mydata, by = "country")
# pass list's content to current environment, based on list's names
list2env(L, envir = environment())
1条答案
按热度按时间9gm1akwq1#