knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of packr is to present a minimal example of package creation in R
. It uses {usethis} functions to create the package, the license, and README.Rmd file, as well as the documentation and appropriate folders for data.
You can install the development version of packr from GitHub with:
if(!require(remotes)){ install.packages("remotes") library(remotes) } remotes::install_github("paezha/packr")
This is a basic example which shows you how to use the package:
library(packr)
What is special about using README.Rmd
instead of just README.md
? You can include R chunks like so:
summary(energy_and_emissions)
You'll still need to render README.Rmd
regularly, to keep README.md
up-to-date. devtools::build_readme()
is handy for this. You could also use GitHub Actions to re-render README.Rmd
every time you push. An example workflow can be found here: https://github.com/r-lib/actions/tree/master/examples.
You can also embed plots, for example:
# Simple Scatterplot attach(energy_and_emissions) plot(Population, bblpd, main="Scatterplot Example", xlab="Population ", ylab="Barrels of oil per day ", pch=19)
In that case, don't forget to commit and push the resulting figure files, so they display on GitHub and CRAN.
And, you can include equations: $$ x^2 + y^2 = z^2 $$
Trying github pages now.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.