You might look at "eval" and "parse".
Reid Huntsinger
-----Original Message-----
From: Spencer Graves [mailto:spencer.graves at pdf.com]
Sent: Tuesday, March 11, 2003 4:03 PM
To: janet rosenbaum
Cc: r-help
Subject: Re: [R] different file types
The command "'source' causes R to accept its input from the named
file".
I don't know what you mean by "associative arrays", but
"`switch'
evaluates `EXPR' and accordingly chooses one of the further arguments".
Hope this helps.
Spencer Graves
janet rosenbaum wrote:> Hi. I am writing a program to read in different types of files from a
> GUI. While it's easy to read different types of text files, I am
> stymied how to make R execute the input.
>
> Ideally I could get the command from input and dereference it like
> `command`(filename)
> where command would be read.dta or read.table or read.xport or any of
> the similar commands.
>
> Also, is there a way to make associative arrays?
> It would be nice to be able to get the format from input and then have
> command<-array[format]
>
> Otherwise, I guess I'll just do cascading if's.
>
> Thanks,
>
> Janet Rosenbaum
jerosenb at fas.harvard.edu> Center for Basic Research in the Social Sciences, Harvard University
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
______________________________________________
R-help at stat.math.ethz.ch mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
------------------------------------------------------------------------------