1
0
Fork
You've already forked mpmisc
0
My miscellaneous R functions
  • R 98%
  • Makefile 2%
2026年06月25日 14:57:51 +02:00
.github update pkgdown workflow 2026年06月19日 10:46:03 +02:00
.hooks chmod +x .hooks 2022年03月23日 15:23:38 +01:00
inst/precommit update description check for pre-commit hooks 2021年09月08日 14:02:50 +02:00
man add 'workflow_badges' file 2026年06月25日 11:55:06 +02:00
R fix another small 🐛 in workflow_names 2026年06月25日 14:57:51 +02:00
.gitignore update gitignore 2022年05月09日 13:07:22 +02:00
.pre-commit-config.yaml update pre-commit-config 2026年06月19日 10:10:33 +02:00
.Rbuildignore .Rbuildignore .hooks 2022年03月23日 16:42:47 +01:00
codemeta.json fix another small 🐛 in workflow_names 2026年06月25日 14:57:51 +02:00
DESCRIPTION fix another small 🐛 in workflow_names 2026年06月25日 14:57:51 +02:00
LICENSE initial commit 2020年06月25日 10:52:22 +02:00
LICENSE.md initial commit 2020年06月25日 10:52:22 +02:00
makefile update makefile; rm readme.rmd; update rcmdcheck workflow 2026年06月19日 10:40:53 +02:00
NAMESPACE add 'workflow_badges' file 2026年06月25日 11:55:06 +02:00
README.md update makefile; rm readme.rmd; update rcmdcheck workflow 2026年06月19日 10:40:53 +02:00

mpmisc

R-CMD-check

Miscellaneous R functions which I load in my .Rprofile, including functions to

  • Increment development version
  • Set up multiple git remotes
  • Add pre-commit hooks to ensure package version is incremented on each commit

Increment development version

One function increment_dev_version() is an alternative version of usethis::use_dev_version(), but adapted to my workflow of incrementing the fourth component of version numbers for every single commit. I have this function aliased to incr="Rscript -e 'mpmisc::increment_dev_version()'", so simply have to type incr to automatically increment my version and update codemeta.json (if that file exists).

Set up git remotes

I mirror many repositories on various git remote services, including Sourcehut, GitLab, BitBucket, and GitHub. The add_git_remotes() function automatically adds the appropriate remote entries for any locations in which a repository is mirrored. I use a single git push alias to mirror that command to all listed remotes. This add_git_remotes() function saves me the trouble of having to manually specify these for each new repository.

Pre-Commit Hooks

I use the precommit package to implement pre-commit hooks, including a personalised hook to ensure that the development version number has been incremented using the above increment_dev_version() function on each commit. This requires installing the pre-commit library, and the precommit R package. This repository then has both:

  1. A version of .pre-commit-config.yaml modified from the original version in the precommit R package, primarily through the addition of:
- id: description version
 name: Version has been incremented in DESCRIPTION
 entry: inst/precommit/description
 language: script
  1. The corresponding inst/precommit/description file which checks first that DESCRIPTION has been modified, and secondly that the modification includes a change to "Version".

In practice, my description hook lives in a general location at ~/bin/precommit/description rather than within any particular repo, with the entry value reflecting this location.