knitr::opts_chunk$set( collapse = TRUE, comment = "#>", # fig.path = "figures/README-", out.width = "100%" ) `%>%` <- purrr::`%>%`
fs
functions, base R, and shell commandsHere are the main two levers that control which libraries are active, in order of scope and persistence:
R_LIBS
and R_LIBS_USER
,
which are consulted at startup..libPaths()
with one or more filepaths.mkdir -p ~/Library/R/4.0/library
cat ~/.Rprofile.site
echo $R_LIBS_USER
.Library .Library.site
In both cases we see two active libraries, consulted in this order:
.libPaths()
lapply( .libPaths(), list.dirs, recursive = FALSE, full.names = FALSE)
packageVersion("devtools") options(buildtools.check = NULL) # devtools::install_github("r-lib/devtools") # packageVersion("devtools")
Optionally run:
# tidyverse::tidyverse_update() # tidyverse::tidyverse_conflicts() tidyverse::tidyverse_packages()
There are three formal requirements:
Unfortunately, this means you can’t use either
hyphens (-
) or underscores (_
) in your package name.
We recommend against using periods in package names,
due to confusing associations with file
extensions and S3 methods.
The available
package has a function called available()
that helps
you evaluate a potential package name from many angles:
devtools::install_github("ropenscilabs/available")
available::suggest(text = "Plotting helpers for arrays.")
library(devtools) library(tidyverse)
source_directory <- "~/RPKGS/GUMED" package_name <- "rraysplot" # fs::dir_create(source_directory) pkg_path <- fs::path(.libPaths()[[1]], package_name) pkg_path src_path <- fs::path(source_directory, package_name) src_path
usethis::create_package(src_path)
✓ Creating '/Users/wbzyl/RPKGS/GUMED/rraysplot/' ✓ Setting active project to '/Users/wbzyl/RPKGS/GUMED/rraysplot' ✓ Creating 'R/' ✓ Writing 'DESCRIPTION' Package: rraysplot Title: What the Package Does (One Line, Title Case) Version: 0.0.0.9000 Authors@R (parsed): * Wlodek <wlodek@rpkgs.com> [aut, cre] Description: What the package does (one paragraph). License: MIT + file LICENSE Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) RoxygenNote: 7.1.1 ✓ Writing 'NAMESPACE' ✓ Writing 'rraysplot.Rproj' ✓ Adding '.Rproj.user' to '.gitignore' ✓ Adding '^rraysplot\\.Rproj$', '^\\.Rproj\\.user$' to '.Rbuildignore' ✓ Opening '/Users/wbzyl/RPKGS/GUMED/rraysplot/' in new RStudio session ✓ Setting active project to '<no active project>'
fs::dir_info( all = TRUE, recurse = TRUE, regexp = "^(.git|.Rproj.user)/.+", invert = TRUE) %>% dplyr::select(path, type)
use_r("make_arrays")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.