Source | R Documentation |
The parameters are analogous to Load.
Source( file, to.list = TRUE, Unlist = TRUE, spray = FALSE, delete.parent = FALSE, Attach = FALSE, First = list(), Setwd = NULL )
file |
the file to load |
to.list |
if TRUE, a list is returned, otherwise an environment |
Unlist |
whether to "unlist" length 1 lists (default is TRUE) |
spray |
whether to create these objects in the global environment (default is FALSE) |
delete.parent |
if an environment is returned, whether to set its parent env to an empty environment (to make a smaller object) |
Attach |
to attach the Source'd environment |
First |
a list of values to be included in the output (that the Source'd script can possibly use) |
The 'file' is sourced but evaluated in a special environment, and the contents of that environment are then returned as a list or environment. If just one object is created in the sourced code, then by default just that object's value is returned (if Unlist is TRUE).
This is useful to avoid overwriting objects in your workspace, for using only parts of a file, and inspecting the contents of files before you load them. You can set your own names to the objects instead of using the ones from the file. E.g., new.name <- Load("manyobjects.rda")$old.name, or ls(Load("manyobjects.rda"))
a list or environment (depending on to.list) or other object (if there is just one object saved and Unlist equals TRUE)
source
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.