Description Usage Arguments Details Examples
Import specific objects (e.g., functions) from a packages namespace.
1 | from(pkg, import, as, envir = .GlobalEnv)
|
pkg |
Character string giving the name of the specific R package from which the objects will be imported. |
import |
Character vector specifying the particular objects to import
from |
as |
Optional character vector specifying the names for which
the imported objects will be assigned to. If missing, then the original
objects (i.e., |
envir |
The environment for which the objects will be loaded into. The
default is |
Normally, one could implement this via object <- pkg::object
, but that
would require a new assignment for each object imported. This method allows
one to import many objects at once from a particular package. It is also less
error-prone then using pkg::object
each time object
is used.
1 2 3 4 5 6 7 | # Importing package plyr's entire namespace can cause issues when package
# dplyr is loaded. Using importr can help mitigate these types of issues. The
# following example assumes that both dplyr and plyr are installed.
library(dplyr)
from("plyr", import = c("ddply", "ldply"))
from("plyr", import = c("ddply", "ldply"), as = c(".ddply", ".ldply"))
identical(ddply, .ddply)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.