Description Usage Arguments Details Value See Also Examples
Check if the RDS file associated to an R object is available
1 2 3 4 5 6 7 8 9 10 | AvailableObj(
obj,
path = NULL,
name = NULL,
parent = NULL,
parent.name = NULL,
relative = NULL,
embedded = NULL,
origin = parent.frame()
)
|
obj |
an R object. |
path |
folder location for RDS files. LittleThumb interprets this path either as
a sub-directory of the |
name |
RESERVED FOR INTERNAL USE: optional name of the R object. When omitted this name is automatically provided by the symbol being passed as first argument using substitute and deparse. |
parent |
environment where the R object should be located.
By default |
parent.name |
optional name of the parent environment. |
relative |
logical value controlling if the |
embedded |
logical value controlling whether child objects should have their associated
RDS files organized into sub-directories corresponding to parent objects
(default = |
origin |
RESERVED FOR INTERNAL USE: parent.frame of the initial function call. |
When unspecified, the value of the following argument(s) are determined by the corresponding automation option(s) (see LittleThumb):
relative
and embedded
TRUE
when the RDS file exists, FALSE
otherwise.
MakeObj, LittleThumb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # Create a simple R object named 'a'
a <- 1:10
# Save object a in the current working directory
SaveObj(a)
# Simulate restarting the R environment
rm(a)
# Check if object a is available in the R environment (FALSE)
exists("a")
# Check if an RDS file is available for object a (TRUE)
AvailableObj(a)
# Load object a from the current working directory
LoadObj(a)
print(a)
# Delete the RDS file associated to object a and remove the object itself
DeleteObj(a)
# Now both lines below should return FALSE
AvailableObj(a)
exists("a")
# A verbose way to automatically make/save/load the object 'a' (don't use this)
if(AvailableObj(a)) {
LoadObj(a)
} else {
a <- 1:10
SaveObj(a)
}
# Automatically make/save/load the object 'a'
MakeObj(a, { a <- 1:10 })
# Cleanup ======================================================================
DeleteObj(a)
unlink("AutoSaved", recursive = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.