Say I have a list of vectors and I want to convert it to a list of single-frame data.frames, for example:
ex <- list(1:3, 4:6, 5:9)
ex1 <- lapply(ex, function(i) data.frame(col1 = i))
Is it possible to do this without an anonymous function? That is, it would be nice to do something like this:
ex2 <- lapply(ex, data.frame, `col1 = i`)
source
share