Statistics for Bioinformatics
Practicals - Configuration

Steps

  1. Specifying your home directory (only required for Windows users)
  2. Loading the R configuration file

Home directory

The R scripts written for this practical will create in your personal account a directory to save the results of your analyses. For this, R needs to know the name of your home directory.

Unix and Mac OS X

If you are running the scripts on a Unix or Mac OS X platform, your system automatically defined your home directory in an environment variable called $HOME.

Windows

If you are running Windows, the variable $HOME is not defined by default, and you need to specify it yourself. The way to specify environment variables depends on the Windows version (in the AUTOEXEC.bat for early versions, in the system preferences for recent versions). If you don't know how to do it on your machine, you can specify it directly from R with the following protocol.

Specifying the $HOME variable from R

  1. Open R
  2. Type the following command This will indicate the current contents of the environment variable $HOME.
  3. If this variable is empty, you can specify with the R command Sys.setenv().

    In Windows Vista, there is an environment variable with your home directory, but its name is USERPROFILE instead of HOME.

    In case the variable USERPROFILE is not defined on your computer, you shoudl find the location of your home directory by your own, and then use it to define, in R, a variable HOME. For example, if your personal folder is "C:\\fred\\", type:

  4. Check that the variable has been stored correctly: (it should now display "C:\\fred")

  5. Check that the folder exists:

Loading the R configuration file

Before running the scripts, you should load the configuration and utilities. For this you can simply run the R command

This script instantiates a series of variables indicating the location of the data files on the web, and the directory where your results will be saved.

You can check the value of these variables with the command

For computer geeks

If you are curious about how the loading was performed, the details can be seen in the two following files, but this is probably not very useful for a first step in R.