Get host computer information from within R code

Issue

I want to get host computer information from R code. For my machine setup program there are slight differences in initial setup of section of the script depending on the machine used, and I need to read this information to know what to do. For example I have to do something like this:

if( isServer() ) {
  resultsDir <- "U:\\Share\\Results\\"
  maxIterations <- 1000
} else {
  resultsDir <- "D:\\Temp\\"
  maxIterations <- 50
}

I’m using Win7 locally and the other machine is Win 2008 Server.

Solution

You can use Sys.info. On my system:

Sys.info()
#  sysname                      release                      version                     nodename                      machine                  </snip>
#"Windows"                      "7 x64" "build 7601, Service Pack 1"                        "***"                     "x86-64"                  </snip>

Answered By – Roland

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published