git2rdata (version 0.1)

upgrade_data: Upgrade Files to the New Version

Description

Updates the data written by older versions to the current data format standard. Works both on a single file and (recursively) on a path. The ".yml" file must contain a "..generic" element. upgrade_data() ignores all other files.

Usage

upgrade_data(file, root = ".", verbose, ..., path)

# S3 method for git_repository upgrade_data(file, root = ".", verbose = TRUE, ..., path, stage = FALSE, force = FALSE)

Arguments

file

the name of the git2rdata object. Git2rdata objects cannot have dots in their name. The name may include a relative path. file is a path relative to the root.

root

The root of a project. Can be a file path or a git-repository. Defaults to the current working directory (".").

verbose

display a message with the update status. Defaults to TRUE.

...

parameters used in some methods

path

specify path instead of file to update all git2rdata objects in this directory and it's subdirectories. path is relative to root. Use path = "." to upgrade all git2rdata objects under root.

stage

Logical value indicating whether to stage the changes after writing the data. Defaults to FALSE.

force

Add ignored files. Default is FALSE.

Value

the git2rdata object names.

See Also

Other internal: is_git2rdata, is_git2rmeta, meta

Examples

Run this code
# NOT RUN {
# create a directory
root <- tempfile("git2rdata-")
dir.create(root)

# write dataframes to the root
write_vc(iris[1:6, ], file = "iris", root = root, sorting = "Sepal.Length")
write_vc(iris[5:10, ], file = "subdir/iris", root = root,
         sorting = "Sepal.Length")
# upgrade a single git2rdata object
upgrade_data(file = "iris", root = root)
# use path = "." to upgrade all git2rdata objects under root
upgrade_data(path = ".", root = root)

# clean up
junk <- file.remove(list.files(root, full.names = TRUE), root)
# }

Run the code above in your browser using DataLab