[R] Evaluation of variable assigned to a function name

Uwe Ligges ligges at statistik.tu-dortmund.de
Mon Jan 10 14:11:48 CET 2011


Wel, just let the user give the function in form of an argument, say 
"foo", and use your code so that


bar <- function(x, ....., foo){
    if(missing(foo)) foo <- Namespace::my.func
    .....
}


but perhaps I misunderstood your question.

Uwe Ligges



On 10.01.2011 13:47, carol white wrote:
> Hi,
> I have defined a function (my.func) which is used as parameter (f) of another
> function. As I want to give the user the possibility to define his own function
> instead of my.func, how can I find out if in other functions, the parameter f
> has the my.func value (if the user has defined a new function or not)?
>
>
> Moreover, I think I should impose to the user to use another function name than
> my.func for this (?). Or a boolean variable is better to be used to indicate if
> my function (my.func) or user-defined function is used?
>
> Thanks
>
> Carol
>
> ______________________________________________
> 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.



More information about the R-help mailing list