One option is:
dosomething <- function(x, data, env=parent.frame()) {
if(!missing(data)) x <- data[,deparse(substitute(x))]
temp <- x^2 + 5
return(temp)
}
On 29/02/2008, Viechtbauer Wolfgang (STAT)
<[EMAIL PROTECTED]> wrote:
> Dear All,
>
> I am working on a function that ha
Dear All,
I am working on a function that has an optional data argument, just like lm().
If the user sets the data argument equal to some dataframe, then the function
should look inside the dataframe for the variables given to other arguments,
otherwise the variables should be accessible from w
2 matches
Mail list logo