xfun::env_option("xfun.test.option") # NULL
Sys.setenv(R_XFUN_TEST_OPTION = "1234")
xfun::env_option("xfun.test.option") # 1234
options(xfun.test.option = TRUE)
xfun::env_option("xfun.test.option") # TRUE (from options())
options(xfun.test.option = NULL) # reset the option
xfun::env_option("xfun.test.option") # 1234 (from env var)
Sys.unsetenv("R_XFUN_TEST_OPTION")
xfun::env_option("xfun.test.option") # NULL again
xfun::env_option("xfun.test.option", FALSE) # use default
Run the code above in your browser using DataLab