diff --git a/.Rbuildignore b/.Rbuildignore index e50130e..31c09fa 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -6,4 +6,6 @@ Images .gitignore RData Siane.Rproj - +^\.github$ +^docs$ +^_pkgdown\.yml$ diff --git a/.github/.gitignore b/.github/.gitignore new file mode 100644 index 0000000..0ce1091 --- /dev/null +++ b/.github/.gitignore @@ -0,0 +1,3 @@ +*.html +R-version +depends.Rds diff --git a/.github/workflows/roscron-check-standard.yaml b/.github/workflows/roscron-check-standard.yaml new file mode 100644 index 0000000..90f1eb9 --- /dev/null +++ b/.github/workflows/roscron-check-standard.yaml @@ -0,0 +1,89 @@ +# For help debugging build failures open an issue on the RStudio community with the 'github-actions' tag. +# https://community.rstudio.com/new-topic?category=Package%20development&tags=github-actions +on: + push: + branches: + - main + - master + pull_request: + branches: + - main + - master + schedule: + - cron: '30 08 1 * *' + + + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: windows-latest, r: 'release'} + - {os: macOS-latest, r: 'release'} + - {os: ubuntu-latest, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + - {os: ubuntu-latest, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest"} + + env: + R_REMOTES_NO_ERRORS_FROM_WARNINGS: true + RSPM: ${{ matrix.config.rspm }} + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@master + with: + r-version: ${{ matrix.config.r }} + + - uses: r-lib/actions/setup-pandoc@master + + - name: Query dependencies + run: | + install.packages('remotes') + saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) + writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") + shell: Rscript {0} + + - name: Restore R package cache + uses: actions/cache@v2.1.6 + with: + path: ${{ env.R_LIBS_USER }} + key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + + - name: Install system dependencies + if: runner.os == 'Linux' + run: | + while read -r cmd + do + eval sudo $cmd + done < <(Rscript -e 'writeLines(remotes::system_requirements("ubuntu", "20.04"))') + + - name: Install dependencies + run: | + remotes::install_deps(dependencies = TRUE) + remotes::install_cran("rcmdcheck") + shell: Rscript {0} + + - name: Check + env: + _R_CHECK_CRAN_INCOMING_REMOTE_: false + run: | + options(crayon.enabled = TRUE) + rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "warning", check_dir = "check") + shell: Rscript {0} + + - name: Upload check results + if: failure() + uses: actions/upload-artifact@main + with: + name: ${{ runner.os }}-r${{ matrix.config.r }}-results + path: check diff --git a/.github/workflows/rostemplate-gh-pages.yaml b/.github/workflows/rostemplate-gh-pages.yaml new file mode 100644 index 0000000..fcf7c31 --- /dev/null +++ b/.github/workflows/rostemplate-gh-pages.yaml @@ -0,0 +1,50 @@ +on: + push: + branches: + - main + - master + +name: rostemplate-gh-pages + +jobs: + rostemplate-gh-pages: + runs-on: macOS-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - uses: actions/checkout@v2 + + - uses: r-lib/actions/setup-r@master + + - uses: r-lib/actions/setup-pandoc@master + + - name: Query dependencies + run: | + install.packages('remotes') + install.packages('devtools') + saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2) + writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version") + shell: Rscript {0} + + - name: Cache R packages + uses: actions/cache@v2.1.6 + with: + path: ${{ env.R_LIBS_USER }} + key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }} + restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1- + + - name: Install dependencies + run: | + remotes::install_deps(dependencies = TRUE) + remotes::install_github("ropenspain/rostemplate", dependencies = TRUE, force = TRUE) + + shell: Rscript {0} + + - name: Install package + run: R CMD INSTALL . + + - name: Deploy package + run: | + git config --local user.email "actions@github.com" + git config --local user.name "GitHub Actions" + Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, clean = TRUE)' diff --git a/DESCRIPTION b/DESCRIPTION index 15ec6a3..25bc566 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,21 +1,35 @@ Package: Siane Title: Explore the Spanish INE Data using this Geographic Tool Version: 0.1 -Description: A tool that assists the user in two tasks: the map reading process and the - data representation process. The reading process is leveraged with functions that allow - the user to find maps in the Siane repository easily, i.e. searching by map year or - administrative level. The other main functionality is to bind numerical data to polygons. - This package is only compatible with the spanish IGN(National Institute of Geography) maps - and the INE(National Institute of Statistics) data. -Imports: plyr, raster, rgdal, sp, methods, utils +Authors@R: + c(person(given = "Carlos J. Gil Bellosta", + role = "aut", + email = "cgb@datanalytics.com"), + person(given = "Nuno", + family = "Carvalho", + role = c("cre", "aut"), + email = "nunocarvalhodossantos@gmail.com")) +Description: A tool that assists the user in two tasks: the map reading + process and the data representation process. The reading process is + leveraged with functions that allow the user to find maps in the Siane + repository easily, i.e. searching by map year or administrative level. + The other main functionality is to bind numerical data to polygons. + This package is only compatible with the spanish IGN(National + Institute of Geography) maps and the INE(National Institute of + Statistics) data. License: MIT + file LICENSE +Imports: + methods, + plyr, + raster, + rgdal, + sp, + utils +Suggests: + knitr, + rmarkdown +VignetteBuilder: + knitr Encoding: UTF-8 LazyData: true -Authors@R: c(person("Carlos J. Gil Bellosta", - email = "cgb@datanalytics.com", role = c("aut")), - person("Nuno", "Carvalho", role = c("cre", "aut"), - email = "nunocarvalhodossantos@gmail.com")) -RoxygenNote: 6.0.1 -Suggests: knitr, - rmarkdown -VignetteBuilder: knitr +RoxygenNote: 7.1.1 diff --git a/R/siane_map.R b/R/siane_map.R index 69995d0..e44eb57 100644 --- a/R/siane_map.R +++ b/R/siane_map.R @@ -30,7 +30,7 @@ #' The default value for the year is the latest year in which the maps are available. \cr #' - The \code{scale} of the maps can be 1:3000000 or 1:6500000. The corresponding values for the \code{scale} variable are "3m" and "6m". \cr #' The default value for the municipalities maps is \code{scale <- "3m"} . The default value for the other maps is \code{scale <- "6m"} \cr -#' #' - The \code{peninsula} variable can take the values "far", "close" and "none". +#' - The \code{peninsula} variable can take the values "far", "close" and "none". #' @export #' #' diff --git a/_pkgdown.yml b/_pkgdown.yml new file mode 100644 index 0000000..e7b815e --- /dev/null +++ b/_pkgdown.yml @@ -0,0 +1,8 @@ +template: + package: rostemplate + +authors: + Carlos J. Gil Bellosta: + href: https://www.datanalytics.com/ + Nuno Carvalho: + href: https://github.com/Nuniemsis diff --git a/man/siane_map.Rd b/man/siane_map.Rd index a5d779b..22f6703 100644 --- a/man/siane_map.Rd +++ b/man/siane_map.Rd @@ -26,18 +26,18 @@ A S4 object specified by the user A function that returns a S4 object(map) of a Spain specific map } \details{ -- \code{obj} should be a string of the path to the maps. It should contain the subfolders \bold{SIANE_CARTO_BASE_S_3M} and \bold{SIANE_CARTO_BASE_S_6M5}. \cr +- \code{obj} should be a string of the path to the maps. It should contain the subfolders \bold{SIANE_CARTO_BASE_S_3M} and \bold{SIANE_CARTO_BASE_S_6M5}. \cr - \code{level} can take the values of "Provincias","Municipios" or "Comunidades". The default value \cr is \code{level <- "Provincias"} \cr - \code{canarias} set to TRUE returns the Canarias map. \code{canarias} set to FALSE returns to the Peninsulae maps. \cr - The \code{year} variable should be numeric. If the map is not available for that year, the loaded map will be the latest available map. \cr -The default value for the year is the latest year in which the maps are available. \cr +The default value for the year is the latest year in which the maps are available. \cr - The \code{scale} of the maps can be 1:3000000 or 1:6500000. The corresponding values for the \code{scale} variable are "3m" and "6m". \cr The default value for the municipalities maps is \code{scale <- "3m"} . The default value for the other maps is \code{scale <- "6m"} \cr -#' - The \code{peninsula} variable can take the values "far", "close" and "none". +- The \code{peninsula} variable can take the values "far", "close" and "none". } \examples{ \dontrun{ obj <- register_siane("/home/ncarvalho/Downloads/") # Registering a sample of Siane -shp <- siane_map(obj = obj, level = "Municipios", canarias = FALSE, peninsula = "close") +shp <- siane_map(obj, level = "Municipios", canarias = FALSE, peninsula = "close") plot(shp) # Plot the map} } diff --git a/vignettes/Siane.Rmd b/vignettes/Siane.Rmd index 08aa875..2e29e79 100644 --- a/vignettes/Siane.Rmd +++ b/vignettes/Siane.Rmd @@ -4,7 +4,7 @@ author: "Nuno Carvalho dos Santos" date: "`r Sys.Date()`" output: rmarkdown::html_vignette vignette: > - %\VignetteIndexEntry{Vignette Title} + %\VignetteIndexEntry{Siane} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- @@ -12,12 +12,12 @@ vignette: > ## Introduction -[Siane](https://github.com/Nuniemsis/Siane/) (El Sistema de Información del Atlas Nacional de España) is a project that supports technologically the publications and productions of the National Spanish Atlas(ANE). Recently, this project released CARTOSIANE, a set of maps compatible with the National Institute of Statistics georreferenced data(INE). +[Siane](https://github.com/ropenspain/Siane/) (El Sistema de Información del Atlas Nacional de España) is a project that supports technologically the publications and productions of the National Spanish Atlas(ANE). Recently, this project released CARTOSIANE, a set of maps compatible with the National Institute of Statistics georreferenced data(INE). The aim of this package is to create useful functions that plot INE's georreferenced data on Siane map's polygons. Siane collects maps from five different scales(1:3M, 1:6.5M, 1:10M, 1:14M, 1:60M). The scope of this project covers the first two scales, i.e, 1:3M and 1:6.5M. The remaining scales represent the countries globally. We are not using those scales. This project focuses only in spanish maps. -Each set of maps is downloaded individually. [The README.md](https://github.com/Nuniemsis/Siane/) file has very detailed information about the downloading process. +Each set of maps is downloaded individually. [The README.md](https://github.com/ropenspain/Siane/) file has very detailed information about the downloading process. ``` SIANE_CARTO_BASE_E_14M.ZIP @@ -33,7 +33,7 @@ In this document I will describe and make use of the main functions of this pack ```{r, warning = FALSE, message = FALSE , eval = FALSE} #library(devtools) -#install_github("Nuniemsis/Siane") +#install_github("ropenspain/Siane") library(Siane) library(pxR) library(RColorBrewer)