Skip to content

Add rogtemplate features #27

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
^\.github$
^paper$
^not_included$
^\._pkgdown\.yml$
2 changes: 2 additions & 0 deletions .github/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.html
R-version
*.Rds
52 changes: 52 additions & 0 deletions .github/workflows/rogtemplate-gh-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Workflow derived from https://github.com/r-lib/actions/tree/master/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
tags: ['*']
workflow_dispatch:

name: rogtemplate-gh-pages

jobs:
rogtemplate-gh-pages:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-pandoc@v1

- uses: r-lib/actions/setup-r@v1
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v1
with:
extra-packages: |
magick
ropengov/rogtemplate

needs: website

- name: Build logo if not present and prepare template
run: |
# Check that logo is not present
if (isFALSE(file.exists(file.path("man", "figures", "logo.png")) ||
file.exists(file.path("man", "figures", "logo.png")))) {
rogtemplate::rog_logo()
} else {

message("The package already has a logo")
}

rogtemplate::rog_add_template_pkgdown()

shell: Rscript {0}

- name: Deploy package
run: |
git config --local user.name "$GITHUB_ACTOR"
git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
88 changes: 41 additions & 47 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,59 @@ Package: regions
Title: Processing Regional Statistics
Version: 0.1.8
Date: 2021-06-19
Authors@R:
c(
person(given = "Daniel",
family = "Antal",
role = c("aut", "cre"),
email = "daniel.antal@ceemid.eu",
comment = c(ORCID = "0000-0001-7513-6760")),
person(given = "Kasia",
family = "Kulma",
role = "ctb",
comment = c(ORCID = "0000-0002-2952-9720")),
person(given = "Istvan",
family = "Zsoldos",
role = c("ctb"),
email = "istvan.zsoldos@gmail.com",
comment = c(ORCID = "0000-0001-5712-2103")),
person(given = "Leo",
family = "Lahti",
role = c("ctb"),
email = "leo.lahti@iki.fi",
comment = c(ORCID = "0000-0001-5537-637X"))
)
Description: Validating sub-national statistical typologies, re-coding across
standard typologies of sub-national statistics, and making valid aggregate
level imputation, re-aggregation, re-weighting and projection down to
lower hierarchical levels to create meaningful data panels and time series.
Authors@R: c(
person("Daniel", "Antal", , "daniel.antal@ceemid.eu", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-7513-6760")),
person("Kasia", "Kulma", role = "ctb",
comment = c(ORCID = "0000-0002-2952-9720")),
person("Istvan", "Zsoldos", , "istvan.zsoldos@gmail.com", role = "ctb",
comment = c(ORCID = "0000-0001-5712-2103")),
person("Leo", "Lahti", , "leo.lahti@iki.fi", role = "ctb",
comment = c(ORCID = "0000-0001-5537-637X"))
)
Description: Validating sub-national statistical typologies, re-coding
across standard typologies of sub-national statistics, and making
valid aggregate level imputation, re-aggregation, re-weighting and
projection down to lower hierarchical levels to create meaningful data
panels and time series.
License: GPL-3
Encoding: UTF-8
Language: en-US
URL: https://regions.dataobservatory.eu/
BugReports: https://github.com/rOpenGov/regions
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
URL: https://regions.dataobservatory.eu/,
https://ropengov.github.io/regions/,
https://github.com/rOpenGov/regions
BugReports: https://github.com/rOpenGov/regions/issues
Depends:
R (>= 2.10)
Imports:
assertthat,
countrycode,
dplyr,
glue,
here,
magrittr,
countrycode,
tidyselect,
utils,
purrr,
readxl,
rlang,
glue,
stats,
tidyr,
readxl,
stringr,
assertthat,
tibble,
here
tidyr,
tidyselect,
utils
Suggests:
knitr,
testthat,
rmarkdown,
covr,
spelling,
devtools,
eurostat,
ggplot2
VignetteBuilder: knitr
ggplot2,
knitr,
rmarkdown,
spelling,
testthat
VignetteBuilder:
knitr
Encoding: UTF-8
Language: en-US
LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
X-schema.org-isPartOf: http://ropengov.org/
X-schema.org-keywords: ropengov
18 changes: 8 additions & 10 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@ knitr::opts_chunk$set(
)
```

# regions
# regions <a href='https://ropengov.github.io/regions/'><img src='man/figures/logo.png' align="right" height="139" /></a>

<!-- badges: start -->
[![rOG-badge](https://ropengov.github.io/rogtemplate/reference/figures/ropengov-badge.svg)](http://ropengov.org/)
[![codecov](https://codecov.io/gh/rOpenGov/regions/branch/master/graph/badge.svg?token=Qc3JHI2ILf)](https://app.codecov.io/gh/rOpenGov/regions)
[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
[![license](https://img.shields.io/badge/license-GPL--3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.en.html)
Expand All @@ -42,7 +43,7 @@ or the released version from CRAN:
install.packages("regions")
```

You can review the complete package documentation on [regions.dataobservaotry.eu](https://regions.dataobservatory.eu/). If you find any problems with the code, please raise an issue on [Github](https://github.com/rOpenGov/regions). Pull requests are welcome if you agree with the [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html)
You can review the complete package documentation on [regions.dataobservatory.eu](https://regions.dataobservatory.eu/). If you find any problems with the code, please raise an issue on [Github](https://github.com/rOpenGov/regions). Pull requests are welcome if you agree with the [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html)

If you use `regions` in your work, please [cite the package](https://doi.org/10.5281/zenodo.5006056).

Expand All @@ -51,18 +52,15 @@ If you use `regions` in your work, please [cite the package](https://doi.org/10.
In international comparison, using nationally aggregated indicators often have many disadvantages, which result from the very different levels of homogeneity, but also from the often very limited observation numbers in a cross-sectional analysis. When comparing European countries, a few missing cases can limit the cross-section of countries to around 20 cases which disallows the use of many analytical methods. Working with sub-national statistics has many advantages: the similarity of the aggregation level and high number of observations can allow more precise control of model parameters and errors, and the number of observations grows from 20 to 200-300.

```{r original-map, echo=FALSE, out.width='80%', fig.align='center', fig.cap='The change from national to sub-national level comes with a huge data processing price: internal administrative boundaries, their names, codes codes change very frequently.'}
knitr::include_graphics(
here::here("vignettes", "indicator_with_map.png")
)
knitr::include_graphics("man/figures/indicator_with_map.png")

```

Yet the change from national to sub-national level comes with a huge data processing price. While national boundaries are relatively stable, with only a handful of changes in each recent decade. The change of national boundaries requires a more-or-less global consensus. But states are free to change their internal administrative boundaries, and they do it with large frequency. This means that the names, identification codes and boundary definitions of sub-national regions change very frequently. Joining data from different sources and different years can be very difficult.

```{r recoded-map, echo=FALSE, out.width='80%', fig.align='center', fig.cap='Our regions R package helps the data processing, validation and imputation of sub-national, regional datasets and their coding.'}

knitr::include_graphics(
here::here("vignettes", "recoded_indicator_with_map.png")
)
knitr::include_graphics("man/figures/recoded_indicator_with_map.png")
```

There are numerous advantages of switching from a national level of the analysis to a sub-national level comes with a huge price in data processing, validation and imputation. The [regions](https://regions.dataobservatory.eu/) package aims to help this process.
Expand Down Expand Up @@ -135,8 +133,8 @@ We started building an experimental APIs data is running regions regularly and i

## Contributors

Thanks for [\@KKulma](https://github.com/KKulma) for the improved continous integration on Github.
Thanks for [\@KKulma](https://github.com/KKulma) for the improved continuous integration on Github.

## Code of Conduct

Please note that the regions project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
Please note that the regions project is released with a [Contributor Code of Conduct](https://contributor-covenant.org/version/2/0/CODE_OF_CONDUCT.html). By contributing to this project, you agree to abide by its terms.
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# regions
# regions <a href='https://ropengov.github.io/regions/'><img src='man/figures/logo.png' align="right" height="139" /></a>

<!-- badges: start -->

[![rOG-badge](https://ropengov.github.io/rogtemplate/reference/figures/ropengov-badge.svg)](http://ropengov.org/)
[![codecov](https://codecov.io/gh/rOpenGov/regions/branch/master/graph/badge.svg?token=Qc3JHI2ILf)](https://app.codecov.io/gh/rOpenGov/regions)
[![Project Status: WIP – Initial development is in progress, but there
has not yet been a stable, usable release suitable for the
Expand Down Expand Up @@ -38,7 +39,7 @@ install.packages("regions")
```

You can review the complete package documentation on
[regions.dataobservaotry.eu](https://regions.dataobservatory.eu/). If
[regions.dataobservatory.eu](https://regions.dataobservatory.eu/). If
you find any problems with the code, please raise an issue on
[Github](https://github.com/rOpenGov/regions). Pull requests are welcome
if you agree with the [Contributor Code of
Expand All @@ -62,7 +63,7 @@ observations grows from 20 to 200-300.

<div class="figure" style="text-align: center">

<img src="C:/_packages/regions/vignettes/indicator_with_map.png" alt="The change from national to sub-national level comes with a huge data processing price: internal administrative boundaries, their names, codes codes change very frequently." width="80%" />
<img src="man/figures/indicator_with_map.png" alt="The change from national to sub-national level comes with a huge data processing price: internal administrative boundaries, their names, codes codes change very frequently." width="80%" />
<p class="caption">
The change from national to sub-national level comes with a huge data
processing price: internal administrative boundaries, their names, codes
Expand All @@ -83,7 +84,7 @@ difficult.

<div class="figure" style="text-align: center">

<img src="C:/_packages/regions/vignettes/recoded_indicator_with_map.png" alt="Our regions R package helps the data processing, validation and imputation of sub-national, regional datasets and their coding." width="80%" />
<img src="man/figures/recoded_indicator_with_map.png" alt="Our regions R package helps the data processing, validation and imputation of sub-national, regional datasets and their coding." width="80%" />
<p class="caption">
Our regions R package helps the data processing, validation and
imputation of sub-national, regional datasets and their coding.
Expand Down Expand Up @@ -138,14 +139,14 @@ recode_nuts(dat = example_df,
knitr::kable()
```

| geo | values | code\_2013 |
|:------|---------:|:-----------|
| FR | 79.70385 | FR |
| UKI3 | 53.50594 | UKI3 |
| DED | 84.45034 | DED |
| FRK | 63.54153 | FR7 |
| HU12 | 23.97015 | NA |
| DEE32 | 26.95203 | NA |
| geo | values | code\_2013 |
|:------|----------:|:-----------|
| FR | 40.890251 | FR |
| UKI3 | 51.361390 | UKI3 |
| DED | 4.765438 | DED |
| FRK | 3.790729 | FR7 |
| HU12 | 75.573507 | NA |
| DEE32 | 6.354310 | NA |

**Hierarchical aggregation and special imputation**: missingness is very
frequent in sub-national statistics, because they are created with a
Expand Down Expand Up @@ -240,7 +241,7 @@ Observatory](https://economy.dataobservatory.eu/).
## Contributors

Thanks for [@KKulma](https://github.com/KKulma) for the improved
continous integration on Github.
continuous integration on Github.

## Code of Conduct

Expand Down
Empty file removed _pkgdown.yml
Empty file.
Loading