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
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.
On 15.06.2011 15:58, Franc Lucas 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)..Use the form TABLE[["2011-01-02"]][["columnD"]] and you can easily replace:> a<- TABLE > b<- " \"2011-01-02\" "use simply b <- "2011-01-02"> c<- "columnD"Now forget the nonsense below and just do: TABLE[[b]][[c]] Uwe Ligges> 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.