Hi,
On Dec 4, 2009, at 12:10 AM, Peng Yu wrote:
> 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
I'm not sure what the other lines(but the last) have to do anything, but are
you looking for something like this:
do.call(rbind, sapply(paste(1:10, 1:10), strsplit, split=' '))
or:
do.call(cbind, sapply(paste(1:10, 1:10), strsplit, split=' '))
?
-steve
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
| Memorial Sloan-Kettering Cancer Center
| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact