简体   繁体   中英

How do I import bash variables in R? (Rstudio server)

Let's say I have environment variables in my bash profile that I want to use in R. How would I call those in? For example:

export MYSQL_USER='bob'
export MYSQL_PWD='secret'

I tried using Sys.getenv("MYSQL_USER") , but it just returns a blank.

If you are running through rstudio server , your Bash startup files are not sourced upon starting your rstudio instance. See this reference to see which file is sourced. On RStudio Server the global startup file is found at R_HOME/etc/Renviron.site by default.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM