Learn R Programming

ami

ami (“am I?”) provides a unified collection of lightweight checks that can be used to better understand the environments in which your code is running. This includes different operating systems, Continuous Integration (CI) environments, containers, and more. Similar or identical functions already exist. However, most of these functions exist within highly specialized packages, so using several of them can quickly create a lot of dependencies for your own projects.

Installation

You can install the latest released version of ami by running:

install.packages("ami")

If you’d like to try out the development version of ami, you can install directly from GitHub:

# install.packages("remotes")
remotes::install_github("briandconnelly/ami")

Some Examples

Am I online?

ami::online()
#> [1] TRUE

Am I using RStudio? Am I using a dark theme?

ami::using_rstudio()
#> [1] FALSE

ami::using_rstudio_dark_theme()
#> [1] FALSE

Am I using macOS and an Intel Mac?

ami::using_macos() && ami::using_x86_cpu()
#> [1] FALSE

Are we running in a Docker container?

ami::using_docker_container()
#> [1] FALSE

Are we using a continuous integration service? GitHub Actions?

ami::using_ci()
#> [1] FALSE

ami::using_github_actions()
#> [1] FALSE

Other environments

ami can be used to check any environment variable. For example, we can see if we’re running in a Poetry environment:

ami::using_envvar("POETRY_ACTIVE")
#> [1] FALSE

We can also check for package options. Here, we’ll see whether boot is configured to do parallel bootstrapping using multiple cores:

ami::using_option("boot.parallel", "multicore")
#> [1] FALSE

If you’re using options as part of package development, check out the options package.

Copy Link

Version

Install

install.packages('ami')

Monthly Downloads

1,487

Version

0.1.1

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Brian Connelly

Last Published

June 16th, 2024

Functions in ami (0.1.1)

using_databricks

Detect Databricks Runtime Environment
online

Checks related to networking
on_bioconductor

Detect Bioconductor
using_config

Detect whether a configuration is currently active
using_cpu

Processor Checks
ami-package

ami: Checks for Various Computing Environments
on_cran

Detect CRAN
using_account

Determine whether a given user account is being used
using_container

Detect container environments
using_conda

Determine whether Conda environment is being used
using_ci

Detect whether running in a CI environment
using_covr

Detect covr
using_vscode

Detect whether code is running in Visual Studio Code
using_envvar

Determine whether an environment variable is being used
using_option

Determine whether a global option is being used
using_r_version

R session information
using_rstudio

RStudio environments
using_os

Tests for operating systems
using_nix_shell

Detect Nix Shell
using_testthat

Detect testthat