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.
upgrade_data(file, root = ".", verbose, ..., path)
# S3 method for git_repository
upgrade_data(
file,
root = ".",
verbose = TRUE,
...,
path,
stage = FALSE,
force = FALSE
)
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
.
Note that file
must point to a location within root
.
The root of a project. Can be a file path or a git-repository
.
Defaults to the current working directory ("."
).
display a message with the update status. Defaults to TRUE
.
parameters used in some methods
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
.
Logical value indicating whether to stage the changes after
writing the data. Defaults to FALSE
.
Add ignored files. Default is FALSE.
the git2rdata object names.
Other internal:
is_git2rdata()
,
is_git2rmeta()
,
meta()
# 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")
#> 09d5bfd6a65e682a4ca030c766348180861568c8
#> "iris.tsv"
#> 0d434e56d22a710c99c5b912e8624d52abd41aaf
#> "iris.yml"
write_vc(iris[5:10, ], file = "subdir/iris", root = root,
sorting = "Sepal.Length")
#> Warning: Sorting on 'Sepal.Length' results in ties.
#> Add extra sorting variables to ensure small diffs.
#> 6e79e0fe40f73c14a7ffc87da75d5637b5986a23
#> "subdir/iris.tsv"
#> 0d434e56d22a710c99c5b912e8624d52abd41aaf
#> "subdir/iris.yml"
# upgrade a single git2rdata object
upgrade_data(file = "iris", root = root)
#> iris already up to date
#> meta_file
#> "iris"
# use path = "." to upgrade all git2rdata objects under root
upgrade_data(path = ".", root = root)
#> iris already up to date
#> ./subdir/iris already up to date
#> ./iris.yml ./subdir/iris.yml
#> "iris" "./subdir/iris"