I have a dataframe with many rows,one column is facor,I want to split the dataframe into list according to the factor column,How can I do it more efficiently?
library(microbenchmark)
size <- 1e7
set.seed(100)
df <- data.frame(
V1 = factor(sample(100, size, replace = TRUE)),
V2 = rnorm(size), v3 = rnorm(size)
)
microbenchmark(dfs <- split(df, df$V1))