11) List all Functions in a Package.

This Blog entry is from the Getting Started in R section in Learn R.

Once a package is loaded, beyond using the help, an understanding of all the functions available to the package can be obtained.   Although a script active, console passive approach is advocated this Blog entry is one of the few occasions where it is more appropriate to use the console directly rather than clutter up the script.

Click on the console window in the bottom left hand corner of RStudio:


Type directly into the console:


Press the Enter key to execute the script:


A list of all functions in the package is returned.

10) Load Packages using Script.

This Blog entry is from the Getting Started in R section in Learn R.

While the toggle function is a useful feature of RStudio,  the intention is to maintain a script Active, Console Passive approach, henceforth it is important to ensure that the librarby() function call, to be streamed to the console is moved to the head of the script and that the detach() function is moved to the base of the script.

Start by navigating to the very top of the script and create a new line in the script editor. Navigate to the start of the first line and press the enter key:


Invoking the library() function,  type:


Intelisense will look through the search path and suggest some packages,  and this can also be auto-completed to ggplot2.  Upon completion of the line,  run the script line to the console:


The ggplot library is now loaded as the first line of the script. 

9) Load and Unload Packages in RStudio.

This Blog entry is from the Getting Started in R section in Learn R.

When a package is installed it is not by default available for use, to save memory and resources.  Loading a package in RStudio is an extremely simple toggle process which will send the command to console to load a specific package on select,  unload on deselect.

Loading a package uses the library() function, invoked before a script is run.

Navigate to the packages pane in the bottom right hand corner of the RStudio, clicking on the tab if necessary.


Note the package that was installed previously,  ggplot2, and the check box to the left hand side of the package name.  To load the package simply select the textbox via a click of the mouse:


On selection of the checkbox the library() function, complete with the required parameters, will be processed in the console.  It can also be observed that the location of the package has been specified in this function call,  although that is not strictly necessary.

To unload the package,  deselect the checkbox in the packages pane next to ggplot2:


On deselection of the checkbox the detatch() function is sent to the console for the package (notice the string will match the return of the search() function).

8) Review Help and Documentation.

This Blog entry is from the Getting Started in R section in Learn R.

In the packages pane a list of all packages installed has been presented. Having followed previous Blog entries we know that ggplot2 is now installed.  It is customary for packages to carry good documentation,  which can be accessed by clicking on the hyperlink overlaying the package name:


Clicking on the link immediate navigation to the packages documentation takes place:


This feature provides a more intuitive means to navigate to documentation for functions. In this example,  scroll down and clock on the function link autoplot:


It can be seen that the documentation is displayed, navigating away from the index.