Skip to content
Back to formatted view

Raw Message

Message-ID: <3A822319EB35174CA3714066D590DCD504AF75CC@usrymx25.merck.com>
Date: 2004-01-08T13:22:10Z
From: Liaw, Andy
Subject: (no subject)

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}}