export | R Documentation |
Call this function as the last line in job::job()
to select what is exported
back into globalenv()
. export()
does nothing if called in any other context.
export(value = "changed", file = NULL)
value |
What to return. One of:
|
file |
Name of |
Under the hood, this function merely rm()
variables that does not match value
.
Because job::job()
returns everything at the end of the script, this defines
what is returned.
NULL
invisibly.
Jonas Kristoffer Lindeløv, jonas@lindeloev.dk
if (rstudioapi::isAvailable()) {
a = 55
b = 77
d = 88
job::job({n = 11; a = 55; job::export("all")}) # export a, b, d, n
job::job({n = 11; a = 11; job::export("changed")}) # export a, n
job::job({n = 11; a = 11; job::export("new")}) # export n
job::job({n = 11; a = 55; job::export(c(a, d, b))}) # export a, d, b
job::job({n = 11; a = 55; job::export("none")}) # export nothing
# To file
job::job({n = 11; a = 11; job::export("changed", file = "jobresult.RData")}) # save a, n
jobresult = new.env() # import to this env instead of global
load("jobresult.RData", envir = jobresult)
print(jobresult$n)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.