Re: [R] how to split several objects' names

From: Sundar Dorai-Raj <>
Date: Thu 07 Jul 2005 - 01:30:37 EST

wu sz wrote:
> Hello,
> I have a string like "O1 O2 O3", O1, O2 and O3 are the names of three
> objects. How to split it into a vector or three new objects, and
> obtain their content? I try to use strsplit to do that, but seems it
> doesn't work like that.

Please provide an example of what you tried or a complete example (see posting guide in signature for tips). I get:

 > strsplit("O1 O2 O3", " ")
[1] "O1" "O2" "O3"

And if O1, O2, and O3 are objects then use ?get, as in:

O1 <- rnorm(10)
O2 <- rnorm(10)
O3 <- rnorm(10)

O <- strsplit("O1 O2 O3", " ")[[1]]
lapply(O, get)

> And what is "<<-" for? the same as "<-"?

Did you try help("<<-")?

HTH, --sundar mailing list PLEASE do read the posting guide! Received on Thu Jul 07 01:35:31 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:16 EST