How can I make R read my environmental variables?

前端 未结 3 1350
温柔的废话
温柔的废话 2020-12-17 08:29

I am running R on EC2 spot instances and I need R to terminate the instance and cancel the spot request once the script has run.

For that I have set the \"Request ID

3条回答
  •  长情又很酷
    2020-12-17 09:07

    You want Sys.getenv() as in Sys.getenv("PATH"), say.

    Or for your example, try

    SIR <- Sys.getenv("SIR")   
    system(paste("ec2-cancel-spot-instance-requests",  SIR))
    

    As for setting variables at startup, see help(Startup) to learn about ~/.Renvironment etc

提交回复
热议问题