[R] 2 functions with same name - what to do to get the one I want

pdb philb at philbrierley.com
Wed Jan 26 11:38:01 CET 2011


There seems to be 2 functions call ecdf...

http://lib.stat.cmu.edu/S/Harrell/help/Hmisc/html/ecdf.html

http://127.0.0.1:11885/library/stats/html/ecdf.html

How do I get the one ecdf {Hmisc} to run instead of the ecdf {stats} 

A pointer in the right direction would be greatly appreciated.


Tried to instal Hmisc but got this message, so I assume I have it

> utils:::menuInstallPkgs()
Warning: package 'Hmisc' is in use and will not be installed
 
 

ran the demo from Hmisc with no luck...

> set.seed(1)
> ch <- rnorm(1000, 200, 40)
> ecdf(ch, xlab="Serum Cholesterol")
Error in ecdf(ch, xlab = "Serum Cholesterol") : 
  unused argument(s) (xlab = "Serum Cholesterol")


ran the sample code from stats and it worked... 
 
> x <- rnorm(12)
> Fn <- ecdf(x)
> Fn     # a *function*
Empirical CDF 
Call: ecdf(x)
 x[1:12] = -1.9123, -1.6626, -1.2468,  ..., 1.1119,  1.135
> Fn(x)  # returns the percentiles for x
 [1] 1.00000000 0.91666667 0.33333333 0.66666667 0.58333333 0.16666667
0.75000000 0.08333333 0.25000000 0.83333333 0.41666667 0.50000000
> tt <- seq(-2,2, by = 0.1)
> 12 * Fn(tt) # Fn is a 'simple' function {with values k/12}
 [1]  0  1  1  1  2  2  2  2  3  3  3  3  4  4  4  5  5  5  6  6  6  7  7  8 
8  8  8  8  8  9 10 10 12 12 12 12 12 12 12 12 12
> 

-- 
View this message in context: http://r.789695.n4.nabble.com/2-functions-with-same-name-what-to-do-to-get-the-one-I-want-tp3237788p3237788.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list