[R] splitting character vectors into multiple vectors using strsplit

R. Michael Weylandt michael.weylandt at gmail.com
Fri Nov 2 21:02:15 CET 2012


On Fri, Nov 2, 2012 at 7:49 PM, David Romano <romanod at grinnell.edu> wrote:
> I don't know if R has the equivalent of an identity
> function, but the following solution accomplishes this:
>
>> splitvectors <- sapply(splitlist, function(x) x)

Indeed it does, called, not surprisingly, "identity." You managed to
guess the definition ;-)

?force also does the same, but the reason for the name is perhaps a
lesson for another time.

Also, note that in certain circumstances c(x) != x because c() strips
attributes.

Cheers,
Michael




More information about the R-help mailing list