Skip to content
Prev 202719 / 398500 Next

How to get a matrix by sapply (with strsplit)?

I want a command (last line) that can return a matrix. I'm wondering
if there is a way to do so.

g<-function(x) {
  c(x,x)
}
lapply(1:10,g)
sapply(1:10,g)

sapply(paste(1:10, 1:10), strsplit, split=' ')# I want a command that
returns a matrix