I'm loading two R packages Hmisc
and TeachingDemos
, which both contain a function called subplot()
. I load the package Hmisc
first and it seems that afterwards the subplot()
-function from Hmisc
is used. This happens even when I load the library TeachingDemos
first.
How can I use the function subplot()
from the TeachingDemos
package, even if the Hmisc
package is also loaded?
Every time you start a new R session you'll need to load the packages/libraries that contain functions you want to use, using either library() or require() . If you load a package with the same function name as in another package, you can use packageName::functionName() to call the function directly.
import: An Import Mechanism for R The syntax allows for importing multiple objects from a package with a single command in an expressive way. The import package bridges some of the gap between using library (or require ) and direct (single-object) imports.
You can use the ::
operator to specify which function to use like this...
TeachingDemos::subplot()
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