Learn R Programming

condathis (version 0.1.2)

env_exists: Check If Environment Already exists

Description

This function checks whether a specified Conda environment already exists in the available environments. It returns TRUE if the environment exists and FALSE otherwise.

Usage

env_exists(env_name, verbose = "silent")

Value

Boolean. TRUE if the environment exists and FALSE otherwise.

Arguments

env_name

Character. Name of the Conda environment where the packages are going to be installed. Defaults to 'condathis-env'.

verbose

Character string specifying the verbosity level of the function's output. Acceptable values are:

  • "silent": Suppress all output from internal command-line tools. Equivalent to FALSE.

  • "cmd": Print the internal command(s) passed to the command-line tool.

  • "output": Print the standard output and error from the command-line tool to the screen. Note that the order of the standard output and error lines may not be correct, as standard output is typically buffered. If the standard output and/or error is redirected to a file or they are ignored, they will not be echoed.

  • "full": Print both the internal command(s) ("cmd") and their standard output and error ("output"). Equivalent to TRUE. Logical values FALSE and TRUE are also accepted for backward compatibility but are soft-deprecated. Please use "silent" and "full" respectively instead.

Examples

Run this code
if (FALSE) {
condathis::with_sandbox_dir({
  # Create the environment
  condathis::create_env(
    packages = "fastqc",
    env_name = "fastqc-env"
  )

  # Check if the environment exists
  condathis::env_exists("fastqc-env")
  #> [1] TRUE

  # Check for a non-existent environment
  condathis::env_exists("non-existent-env")
  #> [1] FALSE
})
}

Run the code above in your browser using DataLab