Title: | Change R Package Name |
---|---|
Description: | Changing the name of an existing R package is annoying but common task especially in the early stages of package development. This package (mostly) automates this task. |
Authors: | Jouni Helske [aut, cre] |
Maintainer: | Jouni Helske <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.0.5 |
Built: | 2024-10-26 03:10:39 UTC |
Source: | https://github.com/helske/changer |
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.
changer( path, new_name, check_validity = TRUE, change_git = TRUE, run_roxygen = FALSE, remote_name = NULL, ask = TRUE, replace_all = FALSE )
changer( path, new_name, check_validity = TRUE, change_git = TRUE, run_roxygen = FALSE, remote_name = NULL, ask = TRUE, replace_all = FALSE )
path |
Path of the package. |
new_name |
Desired name of the package. |
check_validity |
Check first if the package name is valid and available by running the
function |
change_git |
If |
run_roxygen |
Should the package documentation be updated via roxygen? If |
remote_name |
Name of the remote. Defaults to |
ask |
Ask confirmation before starting the rename process. Default is TRUE. |
replace_all |
If |
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.
Warnings:
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: https://www.njtierney.com/post/2017/10/27/change-pkg-name/
content <- letters package.skeleton("package.with.boring.name", path = tempdir()) readLines(file.path(tempdir(), "package.with.boring.name", "DESCRIPTION")) changer(file.path(tempdir(), "package.with.boring.name"), new_name = "superpack", check_validity = FALSE, ask = FALSE) readLines(file.path(tempdir(), "superpack", "DESCRIPTION")) unlink(file.path(tempdir(), "superpack"), recursive = TRUE)
content <- letters package.skeleton("package.with.boring.name", path = tempdir()) readLines(file.path(tempdir(), "package.with.boring.name", "DESCRIPTION")) changer(file.path(tempdir(), "package.with.boring.name"), new_name = "superpack", check_validity = FALSE, ask = FALSE) readLines(file.path(tempdir(), "superpack", "DESCRIPTION")) unlink(file.path(tempdir(), "superpack"), recursive = TRUE)