MyNixOS website logo
Description

Change R Package Name.

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.

changer

R-CMD-check

Changing the name of an existing R package is annoying but common task in the early stages of package development (at least for me). Package changer tries to automate this task:

  1. Validity and availability of the new package name is checked by using available from available).

  2. All complete words matching the package name are replaced in all R scripts, C/C++/Fortran/Stan source codes, markdown files, and typical files in R packages, i.e. files with extension .R, .cpp, .c, .h, .f, .f90, .f95, .stan, .md, .Rmd, .Rnw, .html, .yaml, .yml, and .bib, as well as files DESCRIPTION, NAMESPACEinst/CITATION, .Rbuildignore, and gitignore.

  3. Change file names containing the package name. Only checks files with extensions listed above, as well as files [oldname].Rproj, [oldname]-package.R, [oldname]-defunct.R, and [oldname]-deprecated.R.

  4. If run_roxygen is TRUE (default), old Rd files are removed.

  5. All files with extensions .o, .so, and .dll in /src are removed to force a rebuild of the package.

  6. Name of the package directory is changed.

  7. If change_git is TRUE (default), the remote url of the git repository is changed to match the new name. Note that you still need to change the name of the repository in Github/Bitbucket etc manually. For example in Github: Go to the URL of your Github package, click Settings near the top-right, change the name under Repository name, and click Rename.

  8. If run_roxygen is TRUE, update documentation and rebuild package.

Inspired by back-and-forth naming of the package particlefield) and Nick Tierney's blog post.

Additional issues (read above as well)

  • If the package is already published in CRAN, then you should first consult folks at CRAN whether they will accept the name change.

  • It is strongly recommended to have a backup backup before proceeding.

  • Note that if the old package name is a common word, it will be replaced in the docs etc as well!

Installation

You can install the developed version of changer from Github with:

devtools::install_github("helske/changer")

Usage

There is just one function in the package:

changer("../mypackagewithlongandboringname", "Rbitary")

News

May 2022

  • Fixed a major bug, now actually replaces the package name in the .R files!
  • With additional argument replace_all you can now replace also partial matches instead of just the whole word matches.

February 2022

  • changer now tests that the supplied path actually contains an R package by checking the existence of the DESCRIPTION file.
  • yaml files are also checked, and warning is given regarding the rda files, thanks to Mahmoud Ahmed.
Metadata

Version

0.0.5

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows