r - How to get roxygenise() to check for duplicate function definitions -


i compiling package using roxygen2. able make sure there no function defined twice same name. however, roxygenise() builds package without issuing warning.

e.g.

library(roxygen2)  #' real function real_function <- function(){print("hello world")}  #' fake function real_function <- function(){} 

calling roxygenise() leads second definition being used.

i don't think roxygenise can or should this. if want check duplicate names, can e.g. run through files in directory , attach each file sequentially. attach function has warn.conflicts argument true default.

check_duplicate_names <- function(dir){   files <- list.files(dir)   (file in file.path(dir, files)){     duplicate_test_env <- new.env()     sys.source(file, envir = duplicate_test_env)     attach(duplicate_test_env)   }   (i in seq_along(files)){     detach(duplicate_test_env)   } } check_duplicate_names("path-to-package/r") 

note if have duplicate functions within 1 file not work.


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -