Data Science Desktop Survival Guide
by Graham Williams |
|||||
Commands |
# Load package from the local library into the R session.
library(rattle) A command is also a function and does in fact return a value. In the above example we do not see any value printed. Functions in R can be implemented to return values invisibly. This is the case for base::library(). We can ask R to print the value when the returned result is invisible using the function base::print(). |
# Demonstrate that library() returns a value invisibly.
print(library(rattle))
We see that the value returned by base::library() is a
vector of character strings. Each character string names a package
that has been attached during this session of R. Notice that the
vector begins with item |
# Load a package and save the value returned.
l <- library(rattle) # Review one of the returned values. l[7]
|