View source: R/deployrPackage.R
deployrPackage | R Documentation |
The deployrPackage
function guarantees package portability from your local environment to the DeployR server environment when you use it to declare all of the package dependencies in your R script.
This function safeguards your R code by making certain that the necessary packages are available to your R code at runtime.
For more information on ensuring package portability, see the ‘Writing Portable R Code’ document for your DeployR version on the official DeployR website (http://go.microsoft.com/fwlink/?LinkId=708337).
deployrPackage(pkgs, lib, repos = getOption("repos"), ...)
pkgs |
character vector of the names of packages whose current versions should be downloaded from the repositories. If |
lib |
character vector providing the library directories where to install the packages. Recycled as needed. If missing, defaults to the first element of |
repos |
character vector, the base URL(s) of the repositories to use, such as the URL of a CRAN mirror (for example: http://go.microsoft.com/fwlink/?LinkId=708336.) Can be |
... |
additional arguments to pass to |
Declare the set of package dependencies using this function at the top of your script.
Packages declared using this function are automatically loaded at runtime, either in your local environment or on the DeployR server. The function checks whether the package is installed on the machine on which the script is running. If the package already exists, then it is loaded for you. If not found, the function attempts to install and load the package on your behalf. The deployrPackage
function supports all the same arguments as the regular R install.packages
function.
Note: If you declare your package dependencies with this function and your script still fails due to missing packages, please contact your DeployR server administrator with details.
## Not run:
### PACKAGE DECLARATIONS ###
# Use deployrPackage() to ensure package dependencies are
# installed & loaded at the start of your script.
deployrPackage("ggplot2")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.