setenv2 | R Documentation |
Create a system environment variable with the use of variables. While 'var.name = "testname"; var.value = 7' and 'Sys.setenv(var.name = var.value)' will create 'var.name = 7' in the system environment, 'DIZtools::setenv2(key = var.name, val = var.value)' will create 'testname = 7' in the system environment.
setenv2(key, val)
key |
A character (!) string. The name of the assigned variable |
val |
An object. The object that will be assigned to 'key'. |
No return value, called for side effects (see description).
https://stackoverflow.com/a/12533155
var.name = "testname"
var.value = 7
Sys.setenv(var.name = var.value)
Sys.getenv("testname")
#> [1] ""
Sys.getenv("var.name")
#> [1] "7"
Sys.unsetenv("var.name")
Sys.unsetenv("testname")
setenv2(key = var.name, val = var.value)
Sys.getenv("testname")
#> [1] "7"
Sys.getenv("var.name")
#> [1] ""
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.