[R] exporting character vector to text files

Luis Ridao Cruz Luisr at frs.fo
Fri Jul 27 15:07:18 CEST 2007


R-help,

I have a character vector whose elements are the names of matrixes.
Something like this:

> test <- ls(pattern="Oki")
 [1] "aaOki"    "aOki"     "bOki"     "c1Oki"    "c2Oki"    "c3Oki"   
"cOki"     "dOki"     "eOki"     "fOki"     "gprsOki"  "hOki"     "iOki"
   
[14] "jOki"     "kOki"     "lOki"     "mOki"   ......................

An example:

> aaOki
              x        y
 [1,] -6.333333 61.41667
 [2,] -4.833333 61.41667
 [3,] -4.833333 61.25000
 [4,] -5.000000 61.25000
 [5,] -5.000000 61.16667
 [6,] -5.166667 61.16667
 [7,] -5.166667 61.00000
 [8,] -5.333333 61.00000
 [9,] -5.333333 60.91667
[10,] -5.500000 60.91667
[11,] -5.500000 60.83333
[12,] -5.666667 60.83333
[13,] -5.666667 60.75000
[14,] -5.833333 60.75000
[15,] -5.833333 60.66667
[16,] -6.000000 60.66667
[17,] -6.000000 60.50000
[18,] -6.166667 60.50000
[19,] -6.166667 61.00000
[20,] -6.333333 61.00000
[21,] -6.333333 61.41667

..
..

..

What I want to do is to export these objects to text files
by doing:

for(i in test)
write.table(eval(i),file=paste(i),row.names=FALSE,sep="\t")

but it doesn't work.

Thanks in advance


> version
               _                           
platform       i386-pc-mingw32             
arch           i386                        
os             mingw32                     
system         i386, mingw32               
status                                     
major          2                           
minor          5.1                         
year           2007                        
month          06                          
day            27                          
svn rev        42083                       
language       R                           
version.string R version 2.5.1 (2007-06-27)



More information about the R-help mailing list