Hello,

I'd like to pass a column name as the argument for a function, but I'm
getting "NULL" as a return value.  Any suggestions?  Thanks.

> d <- data.frame(cbind(x=1, y=1:10))
> d
   x  y
1  1  1
2  1  2
3  1  3
4  1  4
5  1  5
6  1  6
7  1  7
8  1  8
9  1  9
10 1 10
> testing <- function(var) {
+ tst <- d$var[3]
+ tst
+ }
>
> dummy <- testing(y)
> dummy
NULL

        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to