Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two functions with the same name in R [duplicate]

Tags:

r

Possible Duplicate:
Masked functions in R
R: Masked Functions
function naming conflicts

If I have two packages: A and B. Say there is function named funfun in A and there is function named funfun in B too. When I load A and B, how do I use the first funfun?

require(A)
require(B)

If I want to use funfun in A, how do I write this?

like image 639
Peng Peng Avatar asked Jul 27 '12 06:07

Peng Peng


1 Answers

You can explictily refer to a package and function combination like this:

A::funfun
B::funfun

In unusual circumstances, you may have to refer to functions that are not exported in the namespace, in which case you need to use:

A:::funfun
B:::funfun

(But this would be unusual, and since non-exported functions do not form part of the package API, these functions could change without warning in subsequent releases of a package.)

like image 53
Paul Hiemstra Avatar answered Sep 21 '22 02:09

Paul Hiemstra