[R] how to split several objects' names
Sundar Dorai-Raj
sundar.dorai-raj at pdf.com
Wed Jul 6 17:30:37 CEST 2005
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]]
[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
More information about the R-help
mailing list