diff --git a/.Rbuildignore b/.Rbuildignore index 0f39077..1d2d465 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -8,3 +8,6 @@ ^pkgdown$ ^\.github$ ^CITATION\.cff$ +^fslogisticskampala\.Rcheck$ +^fslogisticskampala.*\.tar\.gz$ +^fslogisticskampala.*\.tgz$ diff --git a/.gitignore b/.gitignore index 671b0d8..eb1b169 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ .Rproj.user .DS_Store +fslogisticskampala.Rcheck/ +fslogisticskampala*.tar.gz +fslogisticskampala*.tgz diff --git a/README.Rmd b/README.Rmd index 5debe43..64f57a4 100644 --- a/README.Rmd +++ b/README.Rmd @@ -13,7 +13,7 @@ editor_options: knitr::opts_chunk$set( collapse = TRUE, comment = "#>", - fig.path = "man/figures/README-", + fig.path = "man/figures/1README-", out.width = "100%", message = FALSE, warning = FALSE, @@ -38,20 +38,21 @@ The goal of fslogisticskampala is to provide data sources on faecal sludge trans You can install the development version of fslogisticskampala from [GitHub](https://github.com/) with: -``` r +```{r} # install.packages("devtools") devtools::install_github("openwashdata/fslogisticskampala") ``` ```{r} ## Run the following code in console if you don't have the packages -## install.packages(c("dplyr", "knitr", "readr", "stringr", "gt", "kableExtra")) +## install.packages(c("dplyr", "knitr", "readr", "stringr", "gt", "kableExtra". "leaflet")) library(dplyr) library(knitr) library(readr) library(stringr) library(gt) library(kableExtra) +library(leaflet) ``` Alternatively, you can download the individual datasets as a CSV or XLSX @@ -127,8 +128,8 @@ readr::read_csv("data-raw/dictionary.csv") |> kableExtra::scroll_box(height = "200px") ``` -## Example - +## Example 1 +A plot showing the collection locations of the truck with number plate "AUS 119X" ```{r} library(fslogisticskampala) library(ggplot2) @@ -145,9 +146,26 @@ ggplot(aus, aes(x = lon, y = lat, color = date)) + y = "Latitude", color = "Treatment Plant") + theme_minimal() -# Provide some example code here ``` +## Example 2 +An interactive map of all collection points +```{r} +#| label: fig-map_collection_locations +#| fig-cap: "Map with collection locations and the existing treatment plants" +map = leaflet(data = trips) |> + addTiles() |> + addCircleMarkers(~lon, ~lat + ,popup = ~as.character(plant) + , color = ~ifelse(plant == "Bugolobi" , "red", "blue") + , radius = 0.5 + ) |> + addMarkers(lng = ~c(32.6071673,32.5458844) + ,lat = ~c(0.3190139,0.3472747) + ,popup = ~c("Bugolobi FS treatment plant","Lubigi FS treatment plant") + ) +map +``` ## License diff --git a/README.md b/README.md index 5fab085..b68b367 100644 --- a/README.md +++ b/README.md @@ -26,22 +26,23 @@ devtools::install_github("openwashdata/fslogisticskampala") ``` r ## Run the following code in console if you don't have the packages -## install.packages(c("dplyr", "knitr", "readr", "stringr", "gt", "kableExtra")) +## install.packages(c("dplyr", "knitr", "readr", "stringr", "gt", "kableExtra". "leaflet")) library(dplyr) library(knitr) library(readr) library(stringr) library(gt) library(kableExtra) +library(leaflet) ``` Alternatively, you can download the individual datasets as a CSV or XLSX file from the table below. -| dataset | CSV | XLSX | -|:--------|:----------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------------------------| -| trips | [Download CSV](https://github.com/openwashdata/fslogisticskampala/raw/main/inst/extdata/trips.csv) | [Download XLSX](https://github.com/openwashdata/fslogisticskampala/raw/main/inst/extdata/trips.xlsx) | -| trucks | [Download CSV](https://github.com/openwashdata/fslogisticskampala/raw/main/inst/extdata/trucks.csv) | [Download XLSX](https://github.com/openwashdata/fslogisticskampala/raw/main/inst/extdata/trucks.xlsx) | +| dataset | CSV | XLSX | +|:---|:---|:---| +| trips | [Download CSV](https://github.com/openwashdata/fslogisticskampala/raw/main/inst/extdata/trips.csv) | [Download XLSX](https://github.com/openwashdata/fslogisticskampala/raw/main/inst/extdata/trips.xlsx) | +| trucks | [Download CSV](https://github.com/openwashdata/fslogisticskampala/raw/main/inst/extdata/trucks.csv) | [Download XLSX](https://github.com/openwashdata/fslogisticskampala/raw/main/inst/extdata/trucks.xlsx) | ## Data @@ -67,7 +68,7 @@ trips |> gt::as_raw_html() ``` -
+
@@ -103,8 +104,7 @@ trips |> - -
32.56255 Bugolobi
+
For an overview of the variable names, see the following table. @@ -112,98 +112,167 @@ For an overview of the variable names, see the following table.
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ variable_name + variable_type + description
+ fid + numeric + Running ID for each recorded GPS location of a truck.
+ numberplate + character + Numberplate of the truck, can be joined with `trucks` resource.
+ date + Date + Date of the record in ISO 8601 format.
+ time + c(“hms”, “difftime”) + Time of the record in hours, minutes, seconds.
+ lat + numeric + Latitude of the record.
+ lon + numeric + Longitude of the record.
+ plant + character + Treatment plant that the truck delivered faecal sludge to.
@@ -221,7 +290,7 @@ trucks |> gt::as_raw_html() ``` -
+
@@ -237,8 +306,7 @@ trucks |> - -
UAN 030N 3
+
For an overview of the variable names, see the following table. @@ -246,48 +314,80 @@ For an overview of the variable names, see the following table.
+ + + + + + + + + + + + + + + + + + + +
+ variable_name + variable_type + description
+ numberplate + character + Numberplate of the truck, can be joined with `trips` resource.
+ volume + numeric + Volume of the truck in cubic meters.
-## Example +## Example 1 + +A plot showing the collection locations of the truck with number plate +“AUS 119X” ``` r library(fslogisticskampala) @@ -307,12 +407,39 @@ ggplot(aus, aes(x = lon, y = lat, color = date)) + theme_minimal() ``` - + + +## Example 2 + +An interactive map of all collection points ``` r -# Provide some example code here +map = leaflet(data = trips) |> + addTiles() |> + addCircleMarkers(~lon, ~lat + ,popup = ~as.character(plant) + , color = ~ifelse(plant == "Bugolobi" , "red", "blue") + , radius = 0.5 + ) |> + addMarkers(lng = ~c(32.6071673,32.5458844) + ,lat = ~c(0.3190139,0.3472747) + ,popup = ~c("Bugolobi FS treatment plant","Lubigi FS treatment plant") + ) +map ``` +
+ +
+ + +

+ +Map with collection locations and the existing treatment plants +

+ +
+ ## License Data are available as @@ -328,7 +455,8 @@ citation("fslogisticskampala") #> #> Schöbitz L (2024). _fslogisticskampala: Data on faecal sludge #> transporting logistics in Kampala, Uganda_. R package version -#> 0.0.0.9000, . +#> 0.0.0.9000, commit bd332898fba450fc7e0af6d514c9dad9e20f6b11, +#> . #> #> A BibTeX entry for LaTeX users is #> @@ -336,7 +464,7 @@ citation("fslogisticskampala") #> title = {fslogisticskampala: Data on faecal sludge transporting logistics in Kampala, Uganda}, #> author = {Lars Schöbitz}, #> year = {2024}, -#> note = {R package version 0.0.0.9000}, +#> note = {R package version 0.0.0.9000, commit bd332898fba450fc7e0af6d514c9dad9e20f6b11}, #> url = {https://github.com/openwashdata/fslogisticskampala}, #> } ``` diff --git a/man/figures/1README-unnamed-chunk-10-1.png b/man/figures/1README-unnamed-chunk-10-1.png new file mode 100644 index 0000000..b588087 Binary files /dev/null and b/man/figures/1README-unnamed-chunk-10-1.png differ