[R] Escape sequence in eval ()
Jim Holtman
jholtman at gmail.com
Thu Jun 16 12:29:40 CEST 2011
get(a)[[b]][[c]]
with
b <- "2011-01-02"
Sent from my iPad
On Jun 15, 2011, at 9:58, "Franc Lucas" <Franc.Lucas at web.de> wrote:
>
> Hello,
> I am wondering how to get the quotation marks into a variable expression. I
> can't escape it with the backslash \ ...
> Example:
> I can access my data frame via
> TABLE$"2011-01-02"$columnD
> Now I want to do this automatically.. (with a for loop)..
> a <- TABLE
> b <- " \"2011-01-02\" "
> c <- "columnD"
> acessmytable <- paste(a,b,c, sep="$")
> parse(text="accessmytable")
> eval(accessmytable)
> It will return
> [1] "TABLE$\"2011-01-02\"$close"
> but I need
> TABLE$"2011-01-02"$close
> I highly appreciate your help!
> Sincerely,
> Franc
> BS Student, University of Mannheim
>
> Schon gehört? WEB.DE hat einen genialen Phishing-Filter in die
> Toolbar eingebaut! [1]http://produkte.web.de/go/toolbar
>
> References
>
> 1. http://produkte.web.de/go/toolbar
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list