With the increasing abundance of packages for R, I come across functions with identical names across packages often.
For example, I'm using the RuleFit and party packages for R simultaneously, and both have a function with the name 'varimp'. To make sure the right function (from the right package) is being used, add the package name and '::' before calling the function. For example, assuming I have loaded the RuleFit package first, and the party package second, and then created a random forest using the party package, typing:
varimp(forest)
will result in an error, as the forest was created using the party package.
Typing:
party::varimp(forest)
solves the problem.
No comments:
Post a Comment