list_data | R Documentation |
The function returns the names of all valid git2rdata objects. This implies
.tsv
files with a matching valid metadata file (.yml
). Invalid
metadata files result in a warning. The function ignores valid metadata
files without matching raw data (.tsv
).
list_data(root = ".", path = ".", recursive = TRUE)
root |
the |
path |
relative |
recursive |
logical. Should the listing recurse into directories? |
A character vector of git2rdata object names, including their relative path.
Other storage:
prune_meta()
,
read_vc()
,
relabel()
,
rename_variable()
,
rm_data()
,
verify_vc()
,
write_vc()
## on file system # create a directory root <- tempfile("git2rdata-") dir.create(root) # store a dataframe as git2rdata object. Capture the result to minimise # screen output junk <- write_vc(iris[1:6, ], "iris", root, sorting = "Sepal.Length") # write a standard tab separate file (non git2rdata object) write.table(iris, file = file.path(root, "standard.tsv"), sep = "\t") # write a YAML file yml <- list( authors = list( "Research Institute for Nature and Forest" = list( href = "https://www.inbo.be/en"))) yaml::write_yaml(yml, file = file.path(root, "_pkgdown.yml")) # list the git2rdata objects list_data(root) # list the files list.files(root, recursive = TRUE) # remove all .tsv files from valid git2rdata objects rm_data(root, path = ".") # check the removal of the .tsv file list.files(root, recursive = TRUE) list_data(root) # remove dangling git2rdata metadata files prune_meta(root, path = ".") # check the removal of the metadata list.files(root, recursive = TRUE) list_data(root) ## on git repo # initialise a git repo using git2r repo_path <- tempfile("git2rdata-repo-") dir.create(repo_path) repo <- git2r::init(repo_path) git2r::config(repo, user.name = "Alice", user.email = "alice@example.org") # store a dataframe write_vc(iris[1:6, ], "iris", repo, sorting = "Sepal.Length", stage = TRUE) # check that the dataframe is stored status(repo) list_data(repo) # commit the current version and check the git repo commit(repo, "add iris data", session = TRUE) status(repo) # remove the data files from the repo rm_data(repo, path = ".") # check the removal list_data(repo) status(repo) # remove dangling metadata prune_meta(repo, path = ".") # check the removal list_data(repo) status(repo)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.