- INSTANT Heat Maps in R:How-to
- Sebastian Raschka
- 237字
- 2021-08-13 17:08:52
Getting ready
Download the script 5644_01_01.r
from your account at http://www.packtpub.com and save it to your hard disk. The first section of the script, below the comment line starting with ### loading packages
, will automatically check for the availability of the R packages gplots
and lattice
, which are required for this recipe.
If those packages are not already installed, you will be prompted to select an official server from the Comprehensive R Archive Network (CRAN) to allow the automatic download and installation of the required packages.
If you have already installed those two packages prior to executing the script, I recommend you to update them to the most recent version by calling the following function in the R command line:
update.packages("gplots") update.packages("lattice")
Tip
Use the source()
function in the R command-line to execute an external script from any location on your hard drive.
If you start a new R session from the same directory as the location of the script, simply provide the name of the script as an argument in the function call as follows:
source("myScript.r")
You have to provide the absolute or relative path to the script on your hard drive if you started your R session from a different directory to the location of the script. Refer to the following example:
source("/home/username/Downloads/myScript.r")
You can view the current working directory of your current R session by executing the following command in the R command-line:
getwd()