Hi everyone. I want to use 2 different functions (in 2 packages) that have same name. for instance, if I call the function, it will use the one in the last called package. Is there a way to specify the package to use for a function? Something like Package1:myfunction(...) Package2:myfunction(xxx) With regards, Phil -- View this message in context: http://r.789695.n4.nabble.com/Same-function-name-tp2262633p2262633.html Sent from the R help mailing list archive at Nabble.com.
On Mon, Jun 21, 2010 at 2:29 PM, Filoche <pmassicotte at hotmail.com> wrote:> > Hi everyone. > > I want to use 2 different functions (in 2 packages) that have same name. for > instance, if I call the function, it will use the one in the last called > package. ?Is there a way to specify the package to use for a function? > > Something like > > Package1:myfunction(...) > Package2:myfunction(xxx) > > With regards, > PhilYou just needed a little colonic irrigation: library(splancs) splancs::khat(...) might be hard to see on your screen, but it needs two colons between package and function. Barry
package::function On Mon, Jun 21, 2010 at 6:29 AM, Filoche <pmassicotte at hotmail.com> wrote:> > Hi everyone. > > I want to use 2 different functions (in 2 packages) that have same name. for > instance, if I call the function, it will use the one in the last called > package. ?Is there a way to specify the package to use for a function? > > Something like > > Package1:myfunction(...) > Package2:myfunction(xxx) > > With regards, > Phil > -- > View this message in context: http://r.789695.n4.nabble.com/Same-function-name-tp2262633p2262633.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. >
On Mon, 21 Jun 2010, Filoche wrote:> > Hi everyone. > > I want to use 2 different functions (in 2 packages) that have same name. for > instance, if I call the function, it will use the one in the last called > package. Is there a way to specify the package to use for a function? > > Something like > > Package1:myfunction(...) > Package2:myfunction(xxx)(Re?)Read: Writing R Extentions . . . 1.6 Package name spaces R has a name space management system for packages. This system allows the package writer to specify which variables in the package should be exported to make them available to package users, and which variables should be imported from other packages. . . . HTH, Chuck> > With regards, > Phil > -- > View this message in context: http://r.789695.n4.nabble.com/Same-function-name-tp2262633p2262633.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. >Charles C. Berry (858) 534-2098 Dept of Family/Preventive Medicine E mailto:cberry at tajo.ucsd.edu UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901