[R] replacing functions

Paul Hiemstra p.hiemstra at geo.uu.nl
Mon Sep 6 12:02:00 CEST 2010


Hi Karsar,

To replace mean you can make a new function with the same name:

l = runif(10)
mean(l)
mean = function(x) return(1)
mean(l)

But there must be a better way...

cheers,
Paul

On 09/06/2010 11:52 AM, Karen Sargsyan wrote:
>  Dear All,
>
> Is it possible to replace function with my own? I want to apply pca 
> clustering, but
> to use some strange correlation function. I'm asking about replacing, 
> say, mean() with new content of mean() and use standard other 
> functions, which might use mean() as part.
>
> karsar
>
> ______________________________________________
> 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.


-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 253 5773
http://intamap.geo.uu.nl/~paul
http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770



More information about the R-help mailing list