pdb
2011-Jan-26 10:38 UTC
[R] 2 functions with same name - what to do to get the one I want
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.
Dennis Murphy
2011-Jan-26 10:42 UTC
[R] 2 functions with same name - what to do to get the one I want
Hi: It's in your message: :) Hmisc:::ecdf(...) indicates use of the ecdf function in package Hmisc. HTH, Dennis On Wed, Jan 26, 2011 at 2:38 AM, pdb <philb@philbrierley.com> wrote:> > 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. > > ______________________________________________ > R-help@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. >[[alternative HTML version deleted]]
David Winsemius
2011-Jan-26 12:56 UTC
[R] 2 functions with same name - what to do to get the one I want
On Jan 26, 2011, at 5:38 AM, pdb wrote:> > There seems to be 2 functions call ecdf... > > http://lib.stat.cmu.edu/S/Harrell/help/Hmisc/html/ecdf.htmlApparently that used to be its name and that some time in the intervening 10 years the name was changed to Ecdf. The Statlib repository has rather ancient version of the Hmisc documentation. Notice that it gives Harrell's UVa address. You should not use that repository for documentation. Use the RSiteSearch: http://search.r-project.org/cgi-bin/namazu.cgi?query=ecdf&max=100&result=normal&sort=score&idxname=functions -- David.> > 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. > > ______________________________________________ > 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.David Winsemius, MD West Hartford, CT