[R] (no subject)

Liaw, Andy andy_liaw at merck.com
Thu Jan 8 14:22:10 CET 2004


Seems like get() is what you are looking for; e.g., try dim(get("a")),
names(get("a")), etc.

HTH,
Andy

> From: Sixten Borg
> 
> Hello,
> 
> I have trouble converting a character string to a R object. 
> Let me describe this by an example;
> 
> > dim(a)
> [1] 270  14
> > dim("a")
> NULL
> 
> > names(a)
>  [1] "Var1"  "Var2"  "Var3"  "Var4"  "Var5"  "Var6"  "Var7"  
> "Var8"  "Var9" 
> [10] "Var10" "Var11" "Var12" "Var13" "Var14"
> > names("a")
> NULL
> 
> I realise that the character string lacks both a dimension 
> and any column names; my question is how to make R understand 
> that I look for the object a when I write "a".
> 
> Like a type cast in C;      (R data.frame) "a"      for those 
> familiar with C.
> 
> The underlying reason for this is that I am writing a script 
> that imports several datasets. The file names of the datasets 
> contain the '_' character which forces me to construct a 
> valid dataset name for each file. Although I can do this by 
> hand, I would like to know if there is any solution to my 
> first approach.
> 
> Thanks in advance,
> Sixten
> 
> 
> Sixten Borg
> 
> IHE
> Box 2127
> S-220 02 Lund
> Sweden
> 
> tel: +46 46 32 91 07
> fax:+46 46 12 16 04
> 
www.ihe.se


------------------------------------------------------------------------------
Notice:  This e-mail message, together with any attachments,...{{dropped}}




More information about the R-help mailing list