

8.1 Loading and configuring R packagesįor most pipelines, it is straightforward to load the R packages that your targets need in order to run.

Hence, require() is only used when the returned logical value needs to be used.This chapter describes the recommended roles of R packages in targets pipelines and how to manage them in different situations. Warning message in library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :įrom the the above two tests, we can see that test2 (require()) returns a logical value FALSE when an error was occurred while test1 (library()) object was not created when error had occurred. We will store and display the output of the two functions by using an invalid package name to check for error.Įrror in library("abc"): there is no package called 'abc'Įrror in eval(expr, envir, enclos): object 'test1' not found "package 'MASS' was built under R version 3.6.3" It is used in a error checking loop given by thierry. It will return TRUE if the package is present and successfully loaded. require() is only used when we have to use the logical values that it returns. The most commonly used function to load the package is library(). Step 2: Loading a package (require() vs library()) We use the command " install.packages("name of the package") " to install the packageĪfter running the command, you might recieve some messages which is based on the OS, dpendencies installed and the status of the package. This recipe demonstrates the two different ways to load a package after installation.Īccess Loan Eligibility Prediction Projects with Source Code Step 1: Installing packages It is very crucial to load the package before using it in code. We can all the default packages by using code : 'library()'. There already exists some default packages in the local directory 'library' on your machine when you install R. For Example, "dplyr" is one of the commonly used packages in R which adds further functionalities with respect to working with dataframes.

They are stored in the 'library' directory in the R-environment and developed by the community.

R packages consists of a collection of R functions, data sets and compiled code which adds value to the existing R-functionalities.
