flowchart LR A[<font size=4> Liming v1] --> B[<font size=4> Liming v2] B --> C[<font size=4> Liming v3] B --> D[<font size=4> Joe v1] D --> E[<font size=4> Joe + Liming v4] C --> E
Good Software Engineering Practice for R Packages
August 1, 2024
Any opinions expressed in this presentation and on the following slides are solely those of the presenter and not necessarily those of their respective employer or company.
Photo by Rich @ rhubbardstockfootage on Unsplash
Key issue:
Manage complexity over time or between people
Photo from Tim Mossholder on Unsplash
flowchart LR A[<font size=4> Liming v1] --> B[<font size=4> Liming v2] B --> C[<font size=4> Liming v3] B --> D[<font size=4> Joe v1] D --> E[<font size=4> Joe + Liming v4] C --> E
Photo by Lf Asia & the Archive Team CC BY 3.0
gitGraph commit commit commit commit commit
\(\leadsto\) Chain of versions with incremental changes
Photo by Felicia Montenegro on Unsplash
git checkout [commit hash to browse]
git reset --hard [commit hash to reset to]
my-file_final_v2_2019.R
Photo by Mila Tovar on Unsplash
gitGraph commit commit branch feature checkout feature commit commit checkout main commit
git checkout -b [my new branch]
git checkout [branch name]
Photo by Mila Tovar on Unsplash
gitGraph commit commit branch feature checkout feature commit commit checkout main commit merge feature
Photo by Max LaRochelle on Unsplash
gitGraph commit tag: "v0.0.1" commit branch feature-1 checkout feature-1 commit commit checkout main branch feature-2 checkout feature-2 commit checkout feature-1 commit checkout main commit tag: "bugfix" merge feature-1 tag: "v0.1.0" checkout feature-2 commit
sequenceDiagram participant S as Liming participant GH as GitHub server participant J as Joe S->>S: make change locally & commit to <feature> S->>GH: push commit S->>GH: open pull request GH->>GH: run automated checks S->>J: request review J->>J: review code J->>S: request changes S->>S: implement changes locally & commit S->>GH: push commit GH->>GH: run automated checks S->>J: request review J->>J: review code J->>GH: approve changes, unblocking merge GH->>GH: merge <feature> into <main> GH->>GH: run automated checks on <main> GH->>J: pull newest version of <main>
\(\leadsto\) making code-collaboration scalable
README.md
file and set up your environment in posit cloudVersion
field defines the package version.
or -
x.y-z
, equivalent to x.y.z
x
is major: Increment this for breaking changesy
is minor: Increment this for new featuresz
is patch: Increment this for bug fixes onlyx.y.z.9000
and count up during developmentusethis::use_version()
can help with thisvx.y.z
remotes::install_github("org/package", ref = "vx.y.z")
tar.gz
package files are rarely used directly