Displaying 1 result from an estimated 1 matches for "name_of_myvar".
2002 Jan 06
2
Passing names of variables to functions
...variable given to the function in
an output table). For example, in the following (fictional) function I
want some way of printing "x" instead of "myvar" (i.e. the letter "x" and
not the value of x).
myfunc <- function(myvar)
{
cat("Name of input var:", name_of_myvar, "\t", "Value * 2:", myvar * 2)
}
x <- 3
myfunc(x)
Name of input var: x Value * 2: 6
So, how do I get that name_of_myvar bit? I've tried looking through the
help files and cannot find out how to do this. Any ideas?
Thanks,
Dave.
--
David Whiting
Adult Morbidity...