Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect conflicts between packages in R [duplicate]

I've recently found out that errors can be caused due to conflicts between packages, that is, two (or more) packages might have functions named similarly. I know that the code search () produces the list of packages ordered in the way R reads them. There is also the args code which gives the function read by R.
What I would like to know firstly is how to detect if an error is being produced because of conflicts between packages and secondly how to find out which packages are conflicting? Finally, after the conflicts have been detected, how can we force R to use specifically the function from one of the packages?

like image 731
Vara Avatar asked Apr 11 '13 12:04

Vara


1 Answers

If R loads a new package, it will produce a warning if that new package contains any functions that are already present in the working environment. So if you pay attention during package loading, you can see if there are any conflicts. When there are conflicts, you can force R to use the function from a particular package like this:

package_name::function_name
like image 103
Paul Hiemstra Avatar answered Sep 24 '22 10:09

Paul Hiemstra