changer {changer}R Documentation

Change Name of Existing R Package


Changing the name of an existing R package is annoying but common task especially in the early stages of package development. Function changer tries to automate this task. See README for more information.


  check_validity = TRUE,
  change_git = TRUE,
  run_roxygen = FALSE,
  remote_name = NULL,
  ask = TRUE,
  replace_all = FALSE



Path of the package.


Desired name of the package.


Check first if the package name is valid and available by running the function available from the package available Default is TRUE. This will prompt a warning about potentially offensive results from Urban Dictionary which is used to check the validity of the package name.


If TRUE (default), changes the remote url of the remote. Note that you still need to change the name of the GitHub repository manually as follows: Go to the URL of your Github package, click Settings, change the name under "Repository name", and click Rename.


Should the package documentation be updated via roxygen? If TRUE, removes all old Rd files in man directory.


Name of the remote. Defaults to git2r::remotes(path)[1].


Ask confirmation before starting the rename process. Default is TRUE.


If TRUE, replace all occurences of the old package name in files, also in parts of the word. Default is FALSE, so only whole words are replaced.


Note that if the package is already published in CRAN, then the name change is more problematic (you need to ask CRAN for permission first).

If the package is also available in Github, then you need to do the following:

Go to the URL of your Github package, click Settings near the top-right, change the name under "Repository name", and finally click Rename.


If the current name of your package is just some commonly used word (such as "package"), then you are in trouble, as find and replace will change all of those words to new_name as well.

If you have a function with same name as your package, that will change as well.

It is strongly recommended to make backups before proceeding.

Inspired by Nick Tierney's blog post:


content <- letters
package.skeleton("", path = tempdir())
readLines(file.path(tempdir(), "", "DESCRIPTION"))

changer(file.path(tempdir(), ""), 
  new_name = "superpack", check_validity = FALSE, ask = FALSE)
readLines(file.path(tempdir(), "superpack", "DESCRIPTION"))
unlink(file.path(tempdir(), "superpack"), recursive = TRUE)

[Package changer version 0.0.5 Index]