I am creating an R package that I plan to submit to CRAN. How can I check if any of my function names conflict with function names in packages already on CRAN? Before my package goes public, it's still easy to change the names of functions, and I'd like to be a good citizen and avoid conflicts where possible.
For instance, the packages MASS and dplyr both have functions called "select". I'd like to avoid that sort of collision.
There are a lot of packages (9008 at the moment, Aug 2016), so it is almost certainly better to only look at a subset you want to avoid clashes with. Also, to re-emphasise some of the good advice in the comments (just for the record in case comments get deleted, or hidden):
But, if you really want to check all the packages, perhaps to at least know which packages use the same names as yours, you can get a vector of the package names by
crans <- available.packages()[, "Package"]
# A3 abbyyR abc ABCanalysis abc.data abcdeFBA
# "A3" "abbyyR" "abc" "ABCanalysis" "abc.data" "abcdeFBA"
length(crans)
# [1] 9008
You can then install them in bulk using
N = 4 # only using the 1st 4 packages here -
# doing it for the whole lot will take a lot of time and disk space!!!
install.packages(crans[1:N])
Then you can get a list of the function names in these packages with
existing_functions = sapply(1:N, function(i) ls(getNamespace(crans[i])))
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