List all objects in a directory, along with their types.
listObjects(dir, include.children = FALSE)
String containing a path to a directory containing objects saved by saveObject
, possibly in separate subdirectories.
Logical scalar indicating whether to include child objects.
A DFrame where each row corresponds to an object. It contains the following columns:
path
, the relative path to the object's subdirectory inside dir
.
type
, the type of the object based on its OBJECT
file (see ?readObjectFile
).
child
, whether the object is a child of another object.
If include.children=FALSE
, metadata is only returned for non-child objects.
tmp <- tempfile()
dir.create(tmp)
library(S4Vectors)
df <- DataFrame(A=1:10, B=LETTERS[1:10])
saveObject(df, file.path(tmp, "whee"))
ll <- list(A=1, B=LETTERS, C=DataFrame(X=1:5))
saveObject(ll, file.path(tmp, "stuff"))
listObjects(tmp)
#> DataFrame with 2 rows and 3 columns
#> path type child
#> <character> <character> <logical>
#> 1 stuff simple_list FALSE
#> 2 whee data_frame FALSE
listObjects(tmp, include.children=TRUE)
#> DataFrame with 3 rows and 3 columns
#> path type child
#> <character> <character> <logical>
#> 1 stuff simple_list FALSE
#> 2 stuff/other_contents/0 data_frame TRUE
#> 3 whee data_frame FALSE