knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%", eval = FALSE )
The goal of alwaysloaded is to attach frequently-used packages and custom R functions and set desired R options. By placing these in a package rather than in a system- or user-wide .Rprofile
file, these can easily be placed into any project-specific .Rprofile
files and automatically updated whenever alwaysloaded
is changed and re-installed.
You can install alwaysloaded
from GitHub
with:
if (!requireNamespace("remotes", quietly = TRUE)) install.packages("remotes") remotes::install_github("MiguelRodo/alwaysloaded")
The primary function is run_std()
. Adding the code below to .RProfile (access this easily using usethis::edit_r_profile()
)) will ensure that standard actions are performed each time R is loaded, without causing unnecessary issues if alwaysloaded
isn't installed:
if (interactive()) { if (!requireNamespace("alwaysloaded", quietly = TRUE)) { if ("renv:shims" %in% search()) { install_pkg <- renv::install } else { if (!requireNamespace("remotes", quietly = TRUE)) { try(utils::install.packages("remotes")) } install_pkg <- remotes::install_github } install_pkg("MiguelRodo/alwaysloaded") rm("install_pkg") } try(alwaysloaded::run_std()) try(library(alwaysloaded)) }
run_std()
https://cloud.r-project.org
.stringsAsFactors = FALSE
,alwaysloaded::add_options_vsc
for the (many) options set there.magrittr
pipe operator %>%
for R versions before 4.0.0.devtools
-associated functions.kb
and .ob
to knit and open bookdown
output..od
to open a File Explorer pane at a specified directory..rv
to print the current R version.Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.