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

Update docs #4

Merged
merged 6 commits into from
Aug 13, 2023
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
71 changes: 71 additions & 0 deletions .github/workflows/lintr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# lintr provides static code analysis for R.
# It checks for adherence to a given style,
# identifying syntax errors and possible semantic issues,
# then reports them to you so you can take action.
# More details at https://lintr.r-lib.org/

name: lintr

on:
push:
branches:
- main
- master
workflow_dispatch:
pull_request:
# The branches below must be a subset of the branches above
branches:
- main
- master
schedule:
- cron: '56 11 * * 5'

permissions:
contents: read

jobs:
lintr:
name: Run lintr scanning
runs-on: ubuntu-latest
permissions:
contents: read # for checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Setup lintr
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: |
local::.
any::lintr

- name: Run lintr
run: |
# Lintr package
out <- lintr::lint_package()
# Create SARIF report
lintr::sarif_output(out, "lintr-results.sarif")
# Display
out
shell: Rscript {0}
continue-on-error: true

- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: lintr-results.sarif
wait-for-processing: true

21 changes: 21 additions & 0 deletions .github/workflows/pkgcheck.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: pkgcheck

# This will cancel running jobs once a new run is triggered
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

on:
# Manually trigger the Action under Actions/pkgcheck
workflow_dispatch:

jobs:
pkgcheck:
runs-on: ubuntu-latest
steps:
- uses: ropensci-review-tools/pkgcheck-action@main
with:
summary-only: false
post-to-issue: true
append-to-issue: true

25 changes: 22 additions & 3 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ name: test-coverage

jobs:
test-coverage:
runs-on: windows-latest
runs-on: macos-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

Expand All @@ -23,10 +23,29 @@ jobs:

- uses: r-lib/actions/setup-r-dependencies@v2
with:
cache-version: 2
extra-packages: any::covr
needs: coverage

- name: Test coverage
run: covr::codecov()
run: |
covr::codecov(
quiet = FALSE,
clean = FALSE,
install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package")
)
shell: Rscript {0}

- name: Show testthat output
if: always()
run: |
## --------------------------------------------------------------------
find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package

1 change: 1 addition & 0 deletions .github/workflows/wipe-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ jobs:

steps:
- uses: easimon/wipe-cache@main

22 changes: 14 additions & 8 deletions R/utils_download.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,25 @@ catr_hlp_dwnload <- function(api_entry, filename, cache_dir,

# Downloading
if (dwnload) {
err_dwnload <- try(download.file(url, filepath,
quiet = isFALSE(verbose),
mode = "wb"
), silent = TRUE)
err_dwnload <- try(
download.file(url, filepath,
quiet = isFALSE(verbose),
mode = "wb"
),
silent = TRUE
)

# nocov start
# On error retry
if (inherits(err_dwnload, "try-error")) {
if (verbose) message("Retrying query")
err_dwnload <- try(download.file(url, filepath,
quiet = isFALSE(verbose),
mode = "wb"
), silent = TRUE)
err_dwnload <- try(
download.file(url, filepath,
quiet = isFALSE(verbose),
mode = "wb"
),
silent = TRUE
)
}
# nocov end

Expand Down
11 changes: 7 additions & 4 deletions R/utils_read.R
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ st_read_layers_encoding <- function(path, verbose) {
# nocov end


out <- try(sf::st_read(path,
layer = df_layers$layer[1],
quiet = !verbose
), silent = TRUE)
out <- try(
sf::st_read(path,
layer = df_layers$layer[1],
quiet = !verbose
),
silent = TRUE
)

# It may be an error, check
if (inherits(out, "try-error")) {
Expand Down
15 changes: 8 additions & 7 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ library(CatastRoNav)

[![rOS-badge](https://ropenspain.github.io/rostemplate/reference/figures/ropenspain-badge.svg)](https://ropenspain.es/)
[![CatastRoNav status
badge](https://ropenspain.r-universe.dev/badges/CatastRoNav)](https://ropenspain.r-universe.dev)
badge](https://ropenspain.r-universe.dev/badges/CatastRoNav)](https://ropenspain.r-universe.dev/CatastRoNav)
[![R-CMD-check](https://github.com/rOpenSpain/CatastRoNav/workflows/R-CMD-check/badge.svg)](https://github.com/rOpenSpain/CatastRoNav/actions?query=workflow%3AR-CMD-check)
[![codecov](https://codecov.io/gh/rOpenSpain/CatastroNav/branch/main/graph/badge.svg)](https://app.codecov.io/gh/rOpenSpain/CatastroNav)
[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.6366407-blue)](https://doi.org/10.5281/zenodo.6366407)
Expand All @@ -43,12 +43,13 @@ You can install the developing version of **CatastRoNav** using the
[r-universe](https://ropenspain.r-universe.dev/CatastRoNav):

```{r, eval = FALSE}
# Enable this universe
options(repos = c(
ropenspain = "https://ropenspain.r-universe.dev",
CRAN = "https://cloud.r-project.org"
))
install.packages("CatastRoNav")
# Install CatastRoNav in R:
install.packages("CatastRoNav",
repos = c(
"https://ropenspain.r-universe.dev",
"https://cloud.r-project.org"
)
)
```

Alternatively, you can install the developing version of **CatastRoNav** with:
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

[![rOS-badge](https://ropenspain.github.io/rostemplate/reference/figures/ropenspain-badge.svg)](https://ropenspain.es/)
[![CatastRoNav status
badge](https://ropenspain.r-universe.dev/badges/CatastRoNav)](https://ropenspain.r-universe.dev)
badge](https://ropenspain.r-universe.dev/badges/CatastRoNav)](https://ropenspain.r-universe.dev/CatastRoNav)
[![R-CMD-check](https://github.com/rOpenSpain/CatastRoNav/workflows/R-CMD-check/badge.svg)](https://github.com/rOpenSpain/CatastRoNav/actions?query=workflow%3AR-CMD-check)
[![codecov](https://codecov.io/gh/rOpenSpain/CatastroNav/branch/main/graph/badge.svg)](https://app.codecov.io/gh/rOpenSpain/CatastroNav)
[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.6366407-blue)](https://doi.org/10.5281/zenodo.6366407)
Expand All @@ -27,12 +27,13 @@ You can install the developing version of **CatastRoNav** using the
[r-universe](https://ropenspain.r-universe.dev/CatastRoNav):

``` r
# Enable this universe
options(repos = c(
ropenspain = "https://ropenspain.r-universe.dev",
CRAN = "https://cloud.r-project.org"
))
install.packages("CatastRoNav")
# Install CatastRoNav in R:
install.packages("CatastRoNav",
repos = c(
"https://ropenspain.r-universe.dev",
"https://cloud.r-project.org"
)
)
```

Alternatively, you can install the developing version of **CatastRoNav**
Expand Down Expand Up @@ -76,7 +77,7 @@ Navarra</em>.
A BibTeX entry for LaTeX users is:

@Manual{R-catastronav,
title = {{CatastRoNav}: Interface to the {API} Catastro de Navarra},
title = {{CatastRoNav}: Interface to the {API} {Catastro} de {Navarra}},
author = {Diego Hernangómez},
year = {2023},
version = {0.0.2.9000},
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
},
"SystemRequirements": null
},
"fileSize": "682.697KB",
"fileSize": "853.786KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand All @@ -190,7 +190,7 @@
"familyName": "Hernangómez"
}
],
"name": "{CatastRoNav}: Interface to the {API} Catastro de Navarra",
"name": "{CatastRoNav}: Interface to the {API} {Catastro} de {Navarra}",
"identifier": "10.5281/zenodo.6366407",
"url": "https://ropenspain.github.io/CatastRoNav/",
"@id": "https://doi.org/10.5281/zenodo.6366407",
Expand Down
2 changes: 1 addition & 1 deletion inst/CITATION
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ doi <- "10.5281/zenodo.6366407"
bibentry(
"Manual",
header = paste0("To cite '", meta$Package, "' in publications use:"),
title = "{CatastRoNav}: Interface to the {API} Catastro de Navarra",
title = "{CatastRoNav}: Interface to the {API} {Catastro} de {Navarra}",
author = person("Diego", "Hernangómez"),
year = year,
key = "R-catastronav",
Expand Down
36 changes: 36 additions & 0 deletions inst/schemaorg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"@context": "https://schema.org",
"@graph": [
{
"type": "SoftwareSourceCode",
"author": {
"id": "https://orcid.org/0000-0001-8457-4658",
"type": "Person",
"email": "[email protected]",
"familyName": "Hernangómez",
"givenName": "Diego"
},
"codeRepository": "https://github.com/rOpenSpain/CatastRoNav",
"description": "Access public spatial data available under the 'INSPIRE' directive. Tools for downloading references, buildings and addresses of properties on Navarre (Spain).",
"license": "https://spdx.org/licenses/CC-BY-4.0",
"name": "CatastRoNav: Interface to the 'INSPIRE' services of 'Catastro de Navarra'",
"programmingLanguage": {
"type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.3.1 (2023-06-16 ucrt)",
"version": "0.0.2.9000"
},
{
"id": "https://doi.org/10.5281/zenodo.6366407",
"type": "SoftwareSourceCode",
"author": {
"type": "Person",
"familyName": "Hernangómez",
"givenName": "Diego"
},
"name": "{CatastRoNav}: Interface to the {API} {Catastro} de {Navarra}"
}
]
}
14 changes: 8 additions & 6 deletions vignettes/CatastRoNav.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ vignette: >



<!-- CatastRoNav.Rmd is generated from CatastRoNav.Rmd.orig. Please edit that file -->

**CatastRoNav** is a package that provide access to different INSPIRE API
services of the [Cadastre of
Navarre](https://geoportal.navarra.es/es/idena). With
Expand Down Expand Up @@ -62,8 +64,8 @@ ggplot(cp) +
```

<div class="figure">
<img src="./olite-1.png" alt="plot of chunk olite" width="100%" />
<p class="caption">plot of chunk olite</p>
<img src="./olite-1.png" alt="Example: Olite" width="100%" />
<p class="caption">Example: Olite</p>
</div>

### Thematic maps
Expand Down Expand Up @@ -110,8 +112,8 @@ ggplot(dataviz) +
```

<div class="figure">
<img src="./minimal-1.png" alt="plot of chunk minimal" width="100%" />
<p class="caption">plot of chunk minimal</p>
<img src="./minimal-1.png" alt="Minimal map" width="100%" />
<p class="caption">Minimal map</p>
</div>

Let's extract now the construction year, available in the column `beginning`:
Expand Down Expand Up @@ -178,8 +180,8 @@ ggplot(dataviz) +
```

<div class="figure">
<img src="./dataviz-1.png" alt="plot of chunk dataviz" width="100%" />
<p class="caption">plot of chunk dataviz</p>
<img src="./dataviz-1.png" alt="Pamplona: Urban Growth" width="100%" />
<p class="caption">Pamplona: Urban Growth</p>
</div>

## References
Expand Down
Loading