with function from package?

Hey everyone!

I am writing a function that uses some of Rs metaprogramming facilities, including constructing a function call using and a list of arguments.

An issue that has come up is that if i want to include my function in a package, i should refer to functions using namespace::function, rather than importing the package directly. However,"namespace::package",...) does not work. How do i (or call for that matter), with foreign functions inside a package?


Hi @peder2911,

I found that this works, but looks inelegant and uses quosures, I am sure a better way exists (just using as an example one of the examples in the documentation):

f_name = quo(base::paste)
tmp <- expand.grid(letters[1:2], 1:3, c("+", "-"))
q <- quo(!!f_name, c(tmp, sep = "")))

Hey! Thank you for your answer.
Sorry, i wasn't thinking this through: I forgot that doesn't exclusively take string-arguments but can also be passed a function. This means i can just pass it namespace::function. :sweat_smile:

Thanks again!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.