Konrad Konrad - 7 days ago 5
R Question

Calling a special function from within namespace

I'm interested in calling a special function from a namespace without the need to load the package. For instance, as described on R-bloggers, the package

developed by Peter Solymos offers a convenient function
%notin%
. The function is of a simple syntax:

"%notin%" <- function(x, table) !(match(x, table, nomatch = 0) > 0)


Example



I would like to make use of this function without the need load the package. The attempted :

Attempt 1



1:10 mefa4::`%notin%` 7:10


results in an error:

Error: unexpected symbol in "1:10 mefa4"
In addition: Warning message:
package ‘sp’ was built under R version 3.3.2


Attempt 2



mefa4::`%notin%` c(7:10, 1:10)


returns:

Error: unexpected symbol in "mefa4::'%notin%' c"

Answer

You can call the function using:

mefa4::`%notin%`(7:10, 1:10)
Comments