[R] turn character string into unevaluated R object

carol white wht_crl at yahoo.com
Tue Mar 2 23:42:26 CET 2010


Hi,
How to turn a character string into an unevaluated R object? I want to load some files in a directory into data matrix R objects. I could do this with read.table and assign (see below). Then, I want to turn the character string representing a file name (the evaluated expression of i) into an unevaluated R object. Basically, I want to create matrices whose names are the same as the related file names.

Chees,

Carol
----------------------------
suppose I have

mat1, mat2, mat3 files

v = list.files(".", all.files = F, pattern = "mat")
 for (i in v)
	 assign(i, read.table(i, sep = "\t"), pos = 1)

then, I want to have 3 objects with the names mat1, mat2, mat3 containing what mat1, mat2, mat3 files contain.



More information about the R-help mailing list