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() ``` -
| + 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. | +
| + 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 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 +
+ +