Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textdata updates #161

Merged
merged 3 commits into from
Apr 1, 2022
Merged

textdata updates #161

merged 3 commits into from
Apr 1, 2022

Conversation

florisvdh
Copy link
Member

@florisvdh florisvdh commented Apr 1, 2022

  • upgrade most vc-formatted data sources to the format of git2rdata version 0.4.0. In this version, files not optimized for version control (but rather for readability), are saved as csv instead of tsv files. For n2khab, this applies to the types and env_pressures data sources.
  • since it is expected that this upgrade is not compatible with older git2rdata versions, the version dependency for git2rdata is updated.
  • update typegroup membership of type 7210 in scheme GW_03.3, as proposed by @w-jan:
> library(git2rdata)
> library(magrittr)
> scheme_types_new <- read_vc("scheme_types", "inst/textdata/")
> system("git show v0.6.0:inst/textdata/scheme_types.tsv", intern = TRUE) %>% 
+     writeLines(file.path(tempdir(), "scheme_types.tsv")) 
> system("git show v0.6.0:inst/textdata/scheme_types.yml", intern = TRUE) %>% 
+     writeLines(file.path(tempdir(), "scheme_types.yml")) 
> scheme_types_old <- read_vc("scheme_types", tempdir())
> 
> # LINES PRESENT ONLY BEFORE
> scheme_types_old %>% 
+     dplyr::anti_join(scheme_types_new, by = c("scheme", "type", "typegroup"))
   scheme type      typegroup
1 GW_03.3 7210 GW_03.3_group3
> 
> # LINES PRESENT ONLY AFTER
> scheme_types_old %>% 
+     dplyr::anti_join(scheme_types_new, ., by = c("scheme", "type", "typegroup"))
   scheme type      typegroup
1 GW_03.3 7210 GW_03.3_group2
Source code only
library(git2rdata)
library(magrittr)
scheme_types_new <- read_vc("scheme_types", "inst/textdata/")
system("git show v0.6.0:inst/textdata/scheme_types.tsv", intern = TRUE) %>% 
    writeLines(file.path(tempdir(), "scheme_types.tsv")) 
system("git show v0.6.0:inst/textdata/scheme_types.yml", intern = TRUE) %>% 
    writeLines(file.path(tempdir(), "scheme_types.yml")) 
scheme_types_old <- read_vc("scheme_types", tempdir())

# LINES PRESENT ONLY BEFORE
scheme_types_old %>% 
    dplyr::anti_join(scheme_types_new, by = c("scheme", "type", "typegroup"))

# LINES PRESENT ONLY AFTER
scheme_types_old %>% 
    dplyr::anti_join(scheme_types_new, ., by = c("scheme", "type", "typegroup"))

Note that this replaces non-optimized tsv files by non-optimized csv files.
Here, this applies to the types and the env_pressures data sources.
@florisvdh florisvdh merged commit 59a16bc into dev_nextrelease Apr 1, 2022
@florisvdh florisvdh deleted the scheme_types branch April 1, 2022 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant