Determing your machine name using R

I was recently working with someone who was running thousands of R jobs on our Condor pool and some of them were failing. As part of the diagnostic process, we needed to determine which machines in the pool were causing the problem. My solution was to add the line

hostname

To the Bash script that eventually called R and the program he was running. This gives output that looks like this

badmachine.ourdomain.ac.uk

His solution was to do exactly the same thing in R. To do this, he added the following line to the beginning of his R script