diff --git a/.Rbuildignore b/.Rbuildignore
index 28b03fb..a124449 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -21,3 +21,4 @@
^\.github$
^paper$
^not_included$
+^\._pkgdown\.yml$
diff --git a/.github/.gitignore b/.github/.gitignore
index 2d19fc7..00fdd19 100644
--- a/.github/.gitignore
+++ b/.github/.gitignore
@@ -1 +1,3 @@
*.html
+R-version
+*.Rds
diff --git a/.github/workflows/rogtemplate-gh-pages.yaml b/.github/workflows/rogtemplate-gh-pages.yaml
new file mode 100644
index 0000000..f704536
--- /dev/null
+++ b/.github/workflows/rogtemplate-gh-pages.yaml
@@ -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)'
diff --git a/DESCRIPTION b/DESCRIPTION
index 4a73f53..b986a1c 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -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
diff --git a/README.Rmd b/README.Rmd
index e3c3f51..3d2e830 100644
--- a/README.Rmd
+++ b/README.Rmd
@@ -13,9 +13,10 @@ knitr::opts_chunk$set(
)
```
-# regions
+# regions
+[](http://ropengov.org/)
[](https://app.codecov.io/gh/rOpenGov/regions)
[](https://www.repostatus.org/#wip)
[](https://www.gnu.org/licenses/gpl-3.0.en.html)
@@ -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).
@@ -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.
@@ -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.
\ No newline at end of file
+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.
diff --git a/README.md b/README.md
index 268b3b5..1bff933 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,11 @@
-# regions
+# regions
+[](http://ropengov.org/)
[](https://app.codecov.io/gh/rOpenGov/regions)
[. 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
@@ -62,7 +63,7 @@ observations grows from 20 to 200-300.
+
The change from national to sub-national level comes with a huge data processing price: internal administrative boundaries, their names, codes @@ -83,7 +84,7 @@ difficult.
+
Our regions R package helps the data processing, validation and imputation of sub-national, regional datasets and their coding. @@ -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 @@ -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 diff --git a/_pkgdown.yml b/_pkgdown.yml deleted file mode 100644 index e69de29..0000000 diff --git a/inst/WORDLIST b/inst/WORDLIST index 4bc1dd7..3a55de0 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -1,13 +1,8 @@ -Adige -Braga -Bragança CENTRE CMD -COVID Centre -Codecov -Comino -Continente +Choropleth +DED DOI Disaggregation EEA @@ -17,28 +12,24 @@ Eurostat Eurostat's Eurostats Eurostat’s +FRK +FTE FUA -Frech GISCO Github -Gozo Guyane HU Kosovo Közép LAU LAUs -Lativa -Latvias Lietuvos Magyarország -Montengro -Montes NL NSW -Norte OBP QLD +README Recode Recoded Recoding @@ -46,45 +37,41 @@ Relabelling Réunion Schwabia Sostinės -Südtirol TAS -Terras Trentino -Trás Tyrol +UKI Vidurio WIP Wordlist XK -analyse assertthat assuringly backcasting -canidates casted +codecov comformity comparators -connectes continous dat -dataobservaotry de disaggregate disaggregated -disaggregating dplyr eu eurostat +eurozone facto fictious geo geocode geocodes geolocational +geospatial harmonises -impracticalities ir iso +json labelled labelling lau @@ -93,12 +80,12 @@ macroregions metacran microdata naïve -os -policymaking +persreg pre programmatically -proximation +rOG rOpenGov +reaggregate recode recoded recoding @@ -106,8 +93,6 @@ recognised regionas relabelling repo -subdivisons territorially -timewise typological vakarų diff --git a/man/figures/logo.png b/man/figures/logo.png new file mode 100644 index 0000000..392a0b5 Binary files /dev/null and b/man/figures/logo.png differ diff --git a/pkgdown/_pkgdown.yml b/pkgdown/_pkgdown.yml new file mode 100644 index 0000000..27c3095 --- /dev/null +++ b/pkgdown/_pkgdown.yml @@ -0,0 +1,6 @@ +url: https://ropengov.github.io/regions/ +template: + package: rogtemplate + opengraph: + twitter: + site: '@rOpenGov' diff --git a/pkgdown/favicon/apple-touch-icon-120x120.png b/pkgdown/favicon/apple-touch-icon-120x120.png new file mode 100644 index 0000000..75d67b0 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-120x120.png differ diff --git a/pkgdown/favicon/apple-touch-icon-152x152.png b/pkgdown/favicon/apple-touch-icon-152x152.png new file mode 100644 index 0000000..f564052 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-152x152.png differ diff --git a/pkgdown/favicon/apple-touch-icon-180x180.png b/pkgdown/favicon/apple-touch-icon-180x180.png new file mode 100644 index 0000000..5a41c82 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-180x180.png differ diff --git a/pkgdown/favicon/apple-touch-icon-60x60.png b/pkgdown/favicon/apple-touch-icon-60x60.png new file mode 100644 index 0000000..18849c7 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-60x60.png differ diff --git a/pkgdown/favicon/apple-touch-icon-76x76.png b/pkgdown/favicon/apple-touch-icon-76x76.png new file mode 100644 index 0000000..54069f9 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon-76x76.png differ diff --git a/pkgdown/favicon/apple-touch-icon.png b/pkgdown/favicon/apple-touch-icon.png new file mode 100644 index 0000000..5a41c82 Binary files /dev/null and b/pkgdown/favicon/apple-touch-icon.png differ diff --git a/pkgdown/favicon/favicon-16x16.png b/pkgdown/favicon/favicon-16x16.png new file mode 100644 index 0000000..429a054 Binary files /dev/null and b/pkgdown/favicon/favicon-16x16.png differ diff --git a/pkgdown/favicon/favicon-32x32.png b/pkgdown/favicon/favicon-32x32.png new file mode 100644 index 0000000..d95d66e Binary files /dev/null and b/pkgdown/favicon/favicon-32x32.png differ diff --git a/pkgdown/favicon/favicon.ico b/pkgdown/favicon/favicon.ico new file mode 100644 index 0000000..9e32ee9 Binary files /dev/null and b/pkgdown/favicon/favicon.ico differ diff --git a/vignettes/Regional_stats.Rmd b/vignettes/Regional_stats.Rmd index 2ac0736..cf8e582 100644 --- a/vignettes/Regional_stats.Rmd +++ b/vignettes/Regional_stats.Rmd @@ -54,7 +54,7 @@ A typical workflow is this: 4. Aggregate and disaggregate unambiguous changes to the units in the `NUTS2016` – in these cases all the statistical information is present in different form, and any other imputation method would result in loss of existing data. -5. Impute or estimate other regions, using the structural information about the remaining data. This will result in far more superior data than imputation techniques designed for non-aggregated, individual data points; usually a large part of the information is present in statistical tables that can be used for proximation. +5. Impute or estimate other regions, using the structural information about the remaining data. This will result in far more superior data than imputation techniques designed for non-aggregated, individual data points; usually a large part of the information is present in statistical tables that can be used for approximation. When you are working with individual data, you are omitting steps 2-4. When working with national data, especially with small datasets, we can often join data tables by a country name or country code without the problems of 2-4, but even in these cases, imputation rules like using the median value for missing cases is obviously wrong. If the missing value represents a very small member state like Malta, which has a total population smaller than most capital cities in Europe, then using a median or mean country value will very much overestimate a count data for Malta.