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

Peng Yu pengyu.ut at gmail.com
Fri Dec 4 06:10:06 CET 2009


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




More information about the R-help mailing list