Go to TogaWare.com Home Page. Data Science Desktop Survival Guide
by Graham Williams
Duck Duck Go

Working with the Library

Raw To summarise then, when we interact with R we can usually drop the package prefix for those commands that can be found in one (or more) of the attached packages. Throughout the running text in this book we retain the package prefix to clarify where each command comes from. However, within the code we tend to drop the package name prefix. A prefix can still be useful in larger programs to ensure we are using the correct command and to communicate to the human reader where the command comes from. Some packages do implement commands with the same names as commands defined differently and found in other packages and the prefix notation is then useful to specify which command we are referring to. Each of the following chapters will begin with a list of packages to attach from the library into the R session. Below is an example of attaching five common packages for our work. Attaching the listed packages will allow the examples presented within the chapter to be replicated. In the code below take note of the use of the hash () to introduce a comment which is ignored by RR will not attempt to understand the comments as commands. Comments are there to assist the human reader in understanding our programs.
# Load packages required for this script.

library(rattle)   # The weatherAUS dataset and normVarNames().
library(readr)    # Efficient reading of CSV data.
library(dplyr)    # Data wrangling and glimpse().
library(ggplot2)  # Visualise data.
library(magrittr) # Pipes %>%, %<>%, %T>%, %$%.

In starting up an R session (for example, by starting up ) we can enter the above library() commands into an R script file created using the New R Script File menu option in and then ask to Run the commands. will send each command to the R Console which sends the command on to the R software. It is the R software that then runs the commands. If R responds that the package is not available then the package will need to be installed, which we can do from 's Tools menu or by directly using utils::install.packages() as we saw above.


Support further development by purchasing the PDF version of the book.
Other online resources include the GNU/Linux Desktop Survival Guide.
Books available on Amazon include Data Mining with Rattle and Essentials of Data Science.
Popular open source software includes rattle and wajig.
Hosted by Togaware, a pioneer of free and open source software since 1984.
Copyright © 2000-2020 Togaware Pty Ltd. . Creative Commons ShareAlike V4.