[R] Distinguishing variables from functions with the same name

Gabor Grothendieck ggrothendieck at gmail.com
Fri Feb 13 16:47:02 CET 2009


See ?get and try:

sin <- 1
get("sin", mode = "numeric")
get("sin", mode = "function")

On Fri, Feb 13, 2009 at 10:20 AM,  <JLucke at ria.buffalo.edu> wrote:
> guRus:
>
> I have a variable "beta" as an argument to R's beta function.  So
> essentially I have a case of beta(alpha, beta).  What surprises me is that
> R doesn't barf on this stupid programming practice.  R gets the right
> answer.  How does R know "beta the variable" from "beta the function"?
>
> Joseph F. Lucke
> Senior Statistician
> Research Institute on Addictions
> University at Buffalo
> SUNY
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> 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