Many libraries (or packages) are available for R 1 and more than 6500 have been uploaded to the CRAN website. If you are looking for a specific function, it is very likely that somebody has already developed a package and uploaded it to the CRAN website. It can be difficult to know what package to use and often many packages are available for the same task. Some packages (such as for example the survival package) have become the standard whilst others are relatively unknown. An internet search may help to decide on the most appropriate package to use for your task. Always read and download the accompanying reference manual (PDF) from the CRAN website for a complete reference to the package / function.
Installation of packages:
In JGR / Deducer 2;3, packages can be installed with the Package Installer available in the menu. After selecting a suitable CRAN mirror, just enter the first letter of the package, go down the list, select the package, select install and installation should commence.
RStudio 4 also has a package installer under Tools in the menu.
Alternatively, it is possible to enter the installation command directly into the console. For example to install the survival package 5 for the creation of survival curves:
In JGR / Deducer, packages can be made available with Package Manager available from the menu. Selecting ‘loaded’ will load the package, or selecting ‘default’ will make sure the package is installed every time JGR / Deducer is started.
Alternatively, the package can be loaded from the console. For example, to load the survival package, type:
in the console.
The most comprehensive reference to the package can be downloaded from the CRAN website. For example, the PDF file containing the reference manual for survival package can be downloaded from here:
- Select packages from the menu on the left
- Select Table of available package, sorted by name from the main window
- From the top of the screen select S
- Scroll down to survival and select it
- Under Reference manual: select survival.pdf
The reference manual should now available for download.
Further help can also be obtained by typing:
in the console. This should open up a help window with further information and examples on how to use the code.
Packages are not updated automatically and this has to be done manually. To update a package in R:
Or to update all packages:
Enter y for each package that requires updating.
It is not possible to update a package from within itself. Therefore, to update JGR, Deducer and Deducer Extra, go to the R console (not the GUI) and enter: