Skip to content
Back to formatted view

Raw Message

Message-ID: <366c6f340912032110q49c88ae2wf1a1733b7fcb8962@mail.gmail.com>
Date: 2009-12-04T05:10:06Z
From: Peng Yu
Subject: 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