[R] get the content of object in ls()?

From: Meng Cheng <mengcheng81_at_gmail.com>
Date: Thu 28 Jul 2005 - 04:33:57 EST

I am wirting a R script to process some data routinely and have a problem when try to get the content of object in ls()? Here is the script:
> ls()
[1] "a" "b"
[3] "files.num" "fll92_1a_gpr"
[5] "fll92_1a_gpr_norm" "fll92_1a.gpr.norm.scale"
[7] "fname" "fullnames"
[9] "gal" "galfile"
[11] "i" "readGalfile2"
[13] "sample1" "ttest1"

> grep("_gpr$",ls())
[1] 4

> ls()[4]
[1] "fll92_1a_gpr"

> class(ls()[4])
[1] "character"

> class(fll92_1a_gpr)
[1] "marrayRaw"

[1] "marray"

I use the regular expression to get the name of the object I want, which is fll92_1a_gpr, the fourth element in ls() list. But i can't get the content of that object using ls()[4], which gives me a character object(having a double quote). I can still get the data in fll92_1a_gpr by typing fll92_1a_gpr. But this can't be done if I want to implement it in a executable R script. Anyone has an idea how to solve this?


        [[alternative HTML version deleted]]

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Jul 28 04:37:59 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:06 EST