x-creating_a_package.Rmd
The following code outlines the key steps I use to set up the framework for a package, principally using the usethis package.
I create git repo via the GitHub website, the cloned into it by hand by creating an RStudio Project.
I then use usethis::create_package() within my project directory to build the basic package infrastructure This overights the initial project (after a handy prompt in the console).
I create vignette infrastructure and dummy vignette
I then write my vignettes using this template and change the file name. I use “a)”, “b)”, “c)” as a prefix on my vignettes so that show up in order when the website is rendered using packagedown.
I add basic information to the readme fill and add sample code for a call to devtools::install_github() to install the package.
Am not sure how to use this properly yet : (
Add typical files to gitignore: ‘.Rproj.user’, ‘.Rhistory’, ‘.Rdata’, ‘.DS_Store’
these are the packages I typically use. I should vectorize this so it would look nicer : )
usethis::use_package("dplyr", "Imports")
usethis::use_package("tidyr", "Imports")
usethis::use_package("ggplot2", "Imports")
usethis::use_package("ggpubr", "Imports")
# use_package("nlme", "Imports")
# use_package("lme4", "Imports")
# use_package("bbmle", "Imports")
# use_package("RCurl", "Imports")
# use_package("GGally", "Imports")
# use_package("broom", "Imports")
# use_package("arm", "Imports")
# devtools::use_package("data.table", "Imports")
# devtools::use_package("car", "Imports")
# devtools::use_package("lawstat", "Imports")
# devtools::use_package("effsize", "Imports")
# devtools::use_package("here", "Imports")
# devtools::use_package("metafor", "Imports")
# devtools::use_package("Formula", "Imports")
# devtools::use_package("data.tree", "Imports")
Create folder for external data
This could be done with use_directory()
For information on licenses see http://kbroman.org/pkg_primer/pages/licenses.html
Plaintext versions of licenses can be found at https://creativecommons.org/2011/04/15/plaintext-versions-of-creative-commons-licenses-and-cc0/
use_r() #Create or edit a .R file
use_build_ignore() Add files to .Rbuildignore
use_version() use_dev_version() Increment package version
edit_r_profile() edit_r_environ() edit_r_makevars() edit_rstudio_snippets() edit_git_config() edit_git_ignore()
Use a directory