R tricks >

Set environment variables from a file

Create a text file with key-value pairs:

my_variable=somevalue

Set variables using readRenviron() and get them using Sys.getenv():

readRenviron("env.txt")
Sys.getenv("my_variable")