Skip to content
Prev 309698 / 398506 Next

splitting character vectors into multiple vectors using strsplit

HI,
You can also use ?abind() in this case:
library(abind)
abind(splitlist,along=2)
?# ?? [,1] [,2]
#[1,] "a1" "a2"
#[2,] "b1" "b2"
A.K.




----- Original Message -----
From: David Romano <romanod at grinnell.edu>
To: r-help at r-project.org
Cc: 
Sent: Friday, November 2, 2012 3:49 PM
Subject: Re: [R] splitting character vectors into multiple vectors using strsplit

Hi again,

I just wanted to thank folks for their suggestions; they led me to
understand the *apply family a little better, and to realize the issue was
really a question of how to convert a list of equal length vectors into a
matrix.? In this case sapply only needs to be asked to identify these
vectors individually; I don't know if R has the equivalent of an identity
function, but the following solution accomplishes this:
? ?  [,1] [,2]
[1,] "a1" "a2"
[2,] "b1" "b2"

or, by replacing the anonymous function by c, we obtain a more elegant but
more wasteful solution.

Thanks again for everyone's help,
David Romano
On Fri, Sep 7, 2012 at 11:12 AM, David Romano <romanod at grinnell.edu> wrote:

            
??? [[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.