Hi,
Consider the following
x = c(1,2)
y = c(3,4)
d = data.frame(cbind(x,y))
d$x
[1] 1 2
d$"x"
[1] 1 2
foo = function(val)
+ {
+ return(d$val)
+ }
bar = function()
+ {
+ return(d$"x")
+ }
foo("x")
NULL
bar()
[1] 1 2
I'm a little surprised that R accepts both the form d$x and d$"x", but I'm
mostly wondering why foo("x") doesn't work.
Thanks, Faheem.
______________________________________________
R-help@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.