Konrad
Konrad

Reputation: 18585

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 mefa4 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 to 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"

Upvotes: 1

Views: 49

Answers (1)

Rentrop
Rentrop

Reputation: 21497

You can call the function using:

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

Upvotes: 2

Related Questions