The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Basic Path Configuration

Understanding Path Configuration

This guide walks through how to set up basic path configurations in your _envsetup.yml file.

Configuration Structure Levels

Level 1: Execution Environment

Scripts typically execute in different environments depending on your workflow:

default:

dev:

qa:

prod:

Level 2: Paths and Autos

Each execution environment can have different configurations:

default:
  paths:
  autos:

dev:
  paths:
  autos:

qa:
  paths:
  autos:

prod:
  paths:
  autos:

Level 3: Specific Configuration

Configure the actual environment settings:

default:
  paths:
    data: "/demo/DEV/username/project1/data"
    output: "/demo/DEV/username/project1/output"
    programs: "/demo/DEV/username/project1/programs"

Working Example

Let’s create a practical example for a project called project1 that needs data input, result output, and program storage locations.

library(envsetup)

# Create temporary directory for demonstration
dir <- fs::file_temp()
dir.create(dir)
config_path <- file.path(dir, "_envsetup.yml")

# Write a basic config file
file_conn <- file(config_path)
writeLines(
"default:
  paths:
    data: '/demo/DEV/username/project1/data'
    output: '/demo/DEV/username/project1/output'
    programs: '/demo/DEV/username/project1/programs'", file_conn)
close(file_conn)

Loading and Using the Configuration

# Load the configuration
envsetup_config <- config::get(file = config_path)

# Apply the configuration to your R session
rprofile(envsetup_config)
#> Assigned paths to R_GlobalEnv

Accessing Your Configured Paths

Once configured, your paths are available in the envsetup_environment environment within the envsetup package environment:

# See all available path objects
ls(envsetup_environment)
#> [1] "object_metadata"

# Access individual paths
get_path(data)
#> [1] "/demo/DEV/username/project1/data"
get_path(output)
#> [1] "/demo/DEV/username/project1/output"
get_path(programs)
#> [1] "/demo/DEV/username/project1/programs"

How It Works

The rprofile() function:

1. Creates a special environment called envsetup_environment

2. Populates it with your configured path objects

3. Makes these objects accessible in your code via the get_path(), read_path(), and write_path()

Benefits

With this setup:

Next Steps

Now that you understand basic path configuration, the next guide will show you how to manage multiple environments (dev, qa, prod) with different configurations.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.