I have a package that uses the trim() function in the gdata package. I literally use nothing else from the package and (as some of you may have seen) it overwrites some functionality of base R that I need.
Is there a way to load only one function rather than the whole package?
Which function is used for loading packages? Explanation: library() function is used to load a package.
R packages are a collection of R functions, complied code and sample data. They are stored under a directory called "library" in the R environment. By default, R installs a set of packages during installation. More packages are added later, when they are needed for some specific purpose.
Sure. Just use an importFrom
directive in your NAMESPACE file (as described here in R-exts).
importFrom(gdata, trim)
OP EDIT: As of R 3.2.0 there's now a base function: trimws()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With