[R] (no subject)

Sixten Borg sb at ihe.se
Thu Jan 8 14:01:54 CET 2004


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
*******************************************************************
Note: The information contained in this message and attachments may be privileged
and confidential and protected from disclosure. If the reader of this message is not 
the intended recipient you are hereby notified that any dissemination, distribution
or copying of this communication is strictly prohibited. If you have received this 
communication in error, please notify us immediately by replying to the message 
and deleting it from your computer. Thank you. IHE




More information about the R-help mailing list