Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 0 additions & 20 deletions .github/workflows/pr_title.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "git2rdata: Store and Retrieve Data.frames in a Git Repository",
"version": "0.5.1",
"version": "0.5.2",
"license": "GPL-3.0",
"upload_type": "software",
"description": "<p>The git2rdata package is an R package for writing and reading dataframes as plain text files. A metadata file stores important information. 1) Storing metadata allows to maintain the classes of variables. By default, git2rdata optimizes the data for file storage. The optimization is most effective on data containing factors. The optimization makes the data less human readable. The user can turn this off when they prefer a human readable format over smaller files. Details on the implementation are available in vignette(“plain_text”, package = “git2rdata”). 2) Storing metadata also allows smaller row based diffs between two consecutive commits. This is a useful feature when storing data as plain text files under version control. Details on this part of the implementation are available in vignette(“version_control”, package = “git2rdata”). Although we envisioned git2rdata with a git workflow in mind, you can use it in combination with other version control systems like subversion or mercurial. 3) git2rdata is a useful tool in a reproducible and traceable workflow. vignette(“workflow”, package = “git2rdata”) gives a toy example. 4) vignette(“efficiency”, package = “git2rdata”) provides some insight into the efficiency of file storage, git repository size and speed for writing and reading.<\/p>",
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ identifiers:
value: 10.5281/zenodo.1485309
- type: url
value: https://ropensci.github.io/git2rdata/
version: 0.5.1
version: 0.5.2
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: git2rdata
Title: Store and Retrieve Data.frames in a Git Repository
Version: 0.5.1
Version: 0.5.2
Authors@R: c(
person("Thierry", "Onkelinx", , "thierry.onkelinx@inbo.be", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-8804-4216", affiliation = "Research Institute for Nature and Forest (INBO)")),
Expand All @@ -11,7 +11,7 @@ Authors@R: c(
person("Els", "Lommelen", , "els.lommelen@inbo.be", role = "ctb",
comment = c(ORCID = "0000-0002-3481-5684", affiliation = "Research Institute for Nature and Forest (INBO)")),
person("Research Institute for Nature and Forest (INBO)", , , "info@inbo.be", role = c("cph", "fnd"),
comment = c(ROR = "https://ror.org/00j54wy13"))
comment = c(ROR = "00j54wy13"))
)
Description: The git2rdata package is an R package for writing and reading
dataframes as plain text files. A metadata file stores important
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# git2rdata 0.5.2

* Bugfix in `rename_variable()` thanks to @florisvdh for finding and fixing the
bug.

# git2rdata 0.5.1

* `write_vc()` stores metadata stored in the data frame.
Expand Down
5 changes: 4 additions & 1 deletion R/rename_variable.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
#' @inheritParams write_vc
#' @param change A named vector with the old names as values and the new names
#' as names.
#' @return invisible `NULL`.
#' @return a named vector with the file paths relative to `root`. The names
#' contain the hashes of the files.
#' @export
#' @examples
#'
Expand Down Expand Up @@ -106,6 +107,8 @@ rename_variable.character <- function(file, change, root = ".", ...) {
yaml[["..generic"]][["data_hash"]] <- datahash(file["raw_file"])
write_yaml(yaml, file["meta_file"], fileEncoding = "UTF-8")

root <- normalizePath(root, winslash = "/", mustWork = TRUE)
file <- normalizePath(file, winslash = "/", mustWork = TRUE)
hashes <- remove_root(file = file, root = root)
names(hashes) <-
c(
Expand Down
6 changes: 3 additions & 3 deletions inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ citHeader("To cite `git2rdata` in publications please use:")
# begin checklist entry
bibentry(
bibtype = "Manual",
title = "git2rdata: Store and Retrieve Data.frames in a Git Repository. Version 0.5.1",
title = "git2rdata: Store and Retrieve Data.frames in a Git Repository. Version 0.5.2",
author = c(person(given = "Thierry", family = "Onkelinx")),
year = 2025,
year = 2026,
url = "https://ropensci.github.io/git2rdata/",
abstract = "The git2rdata package is an R package for writing and reading dataframes as plain text files. A metadata file stores important information. 1) Storing metadata allows to maintain the classes of variables. By default, git2rdata optimizes the data for file storage. The optimization is most effective on data containing factors. The optimization makes the data less human readable. The user can turn this off when they prefer a human readable format over smaller files. Details on the implementation are available in vignette(\"plain_text\", package = \"git2rdata\"). 2) Storing metadata also allows smaller row based diffs between two consecutive commits. This is a useful feature when storing data as plain text files under version control. Details on this part of the implementation are available in vignette(\"version_control\", package = \"git2rdata\"). Although we envisioned git2rdata with a git workflow in mind, you can use it in combination with other version control systems like subversion or mercurial. 3) git2rdata is a useful tool in a reproducible and traceable workflow. vignette(\"workflow\", package = \"git2rdata\") gives a toy example. 4) vignette(\"efficiency\", package = \"git2rdata\") provides some insight into the efficiency of file storage, git repository size and speed for writing and reading.",
textVersion = "Onkelinx, Thierry (2025) git2rdata: Store and Retrieve Data.frames in a Git Repository. Version 0.5.1. https://ropensci.github.io/git2rdata/",
textVersion = "Onkelinx, Thierry (2026) git2rdata: Store and Retrieve Data.frames in a Git Repository. Version 0.5.2. https://ropensci.github.io/git2rdata/",
keywords = "git; version control; plain text data",
doi = "10.5281/zenodo.1485309",
)
Expand Down
3 changes: 2 additions & 1 deletion man/rename_variable.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions organisation.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
checklist version: 0.5.1
checklist version: 0.5.3
git: https://github.com/ropensci
info@inbo.be:
name:
Expand All @@ -9,7 +9,7 @@ info@inbo.be:
email: info@inbo.be
website: https://www.vlaanderen.be/inbo/en-gb
logo: https://inbo.github.io/checklist/reference/figures/logo-en.png
ror: https://ror.org/00j54wy13
ror: 00j54wy13
orcid: yes
zenodo: inbo
rightsholder: single
Expand Down
21 changes: 21 additions & 0 deletions tests/testthat/test_g_rename_variable.R
Original file line number Diff line number Diff line change
Expand Up @@ -227,3 +227,24 @@ test_that("rename_variable() handles wrong type of root", {
"a 'root' of class numeric is not supported"
)
})

test_that("rename_variable() shows no root in returned file names", {
root <- tempfile(pattern = "git2rdata-rename-")
dir.create(root)
filename <- "unsorted"
files <- suppressWarnings(
write_vc(
test_data,
file = filename,
split_by = "test_factor",
root = root,
strict = FALSE
)
)
result <- rename_variable(
file = filename,
root = root,
change = c("new_var" = "test_Date")
)
expect_no_match(result, "git2rdata-rename-")
})