diff --git a/DESCRIPTION b/DESCRIPTION index bcf6cc1..2afd210 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -15,12 +15,11 @@ License: CC0 Depends: R (>= 2.10) Imports: raster, - rgdal, - rgeos + sf Encoding: UTF-8 Language: en-GB LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.1 +RoxygenNote: 7.1.2 URL: https://github.com/spatialworks/tanzania, https://spatialworks.io/tanzania/ BugReports: https://github.com/spatialworks/tanzania/issues diff --git a/R/data.R b/R/data.R index 32e7c8c..dd40eed 100644 --- a/R/data.R +++ b/R/data.R @@ -101,9 +101,6 @@ #' livestock production systems V5 (5 minutes of arc)", #' https://doi.org/10.7910/DVN/WPDSZE, Harvard Dataverse, V1 #' -#' @examples -#' ruminant_population -#' # ################################################################################ "ruminant_population" diff --git a/README.Rmd b/README.Rmd index e28e10d..abf58f3 100644 --- a/README.Rmd +++ b/README.Rmd @@ -17,11 +17,13 @@ knitr::opts_chunk$set( ``` -# tanzania: Datasets for Use in Designing Surveys in Tanzania +# tanzania: Datasets for Use in Designing Surveys in Tanzania [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) +[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental) [![R-CMD-check](https://github.com/spatialworks/tanzania/workflows/R-CMD-check/badge.svg)](https://github.com/spatialworks/tanzania/actions?query=workflow%3AR-CMD-check) +[![CodeFactor](https://www.codefactor.io/repository/github/spatialworks/tanzania/badge)](https://www.codefactor.io/repository/github/spatialworks/tanzania) Designing surveys require relevant datasets to be used as basis for sample size calculations, sampling design, survey planning/logistics and survey implementation. These include datasets on population, lists of sampling clusters, map datasets for spatial sampling, and previous survey datasets that can be used for estimating indicator variance and design effects. This package contains relevant datasets for use in designing surveys in Tanzania. @@ -40,8 +42,7 @@ remotes::install_github("spatialworks/tanzania") When installing `tanzania`, geospatial packages on which `tanzania` depends on are also installed. To use `tanzania` package, it will be important to load these package dependencies that have been installed. This can be done by: ```{r dependencies} -library(rgdal) -library(rgeos) +library(sf) library(raster) ``` @@ -55,8 +56,8 @@ tanzania::region The region borders of Tanzania can be plotted by: -```{r regionPlot, fig.align = "center"} -sp::plot(tanzania::region) +```{r regionPlot, fig.align = "center", fig.width = 10, fig.height = 10} +plot(st_geometry(tanzania::region)) ``` ### District borders @@ -69,8 +70,8 @@ tanzania::district The district borders of Tanzania can be plotted by: -```{r districtPlot, fig.align = "center"} -sp::plot(tanzania::district) +```{r districtPlot, fig.align = "center", fig.width = 10, fig.height = 10} +plot(st_geometry(tanzania::district)) ``` ### Ward borders @@ -83,8 +84,8 @@ tanzania::ward The ward borders of Tanzania can be plotted by: -```{r wardPlot, fig.align = "center"} -sp::plot(tanzania::ward) +```{r wardPlot, fig.align = "center", fig.width = 10, fig.height = 10} +plot(st_geometry(tanzania::ward)) ``` ### Village borders @@ -97,8 +98,8 @@ tanzania::village The village borders of Tanzania can be plotted by: -```{r villagePlot, fig.align = "center"} -sp::plot(tanzania::village) +```{r villagePlot, fig.align = "center", fig.width = 10, fig.height = 10} +plot(st_geometry(tanzania::village)) ``` ### Livelihood zones borders @@ -111,7 +112,7 @@ tanzania::livelihood_zone The livelihood zone borders of Tanzania can be plotted by: -```{r lhzPlot, fig.align = "center"} -sp::plot(tanzania::livelihood_zone) +```{r lhzPlot, fig.align = "center", fig.width = 10, fig.height = 10} +plot(st_geometry(tanzania::livelihood_zone)) ``` diff --git a/data-raw/processMaps.R b/data-raw/processMaps.R index e8ab121..31ddedd 100644 --- a/data-raw/processMaps.R +++ b/data-raw/processMaps.R @@ -9,31 +9,38 @@ library(stringr) ## Read maps ################################################################### ## Livelihood zones ------------------------------------------------------------ -livelihood_zone <- readOGR(dsn = "data-raw/TZ_LHZ_2009", layer = "TZ_LHZ_2009") -#livelihood_zone <- st_read(dsn = "data-raw/TZ_LHZ_2009", layer = "TZ_LHZ_2009") +#livelihood_zone <- readOGR(dsn = "data-raw/TZ_LHZ_2009", layer = "TZ_LHZ_2009") +livelihood_zone <- st_read(dsn = "data-raw/TZ_LHZ_2009", layer = "TZ_LHZ_2009") usethis::use_data(livelihood_zone, overwrite = TRUE, compress = "xz") ## Region ---------------------------------------------------------------------- -region <- readOGR(dsn = "data-raw/GIS_Maps", layer = "Regions") -region <- spTransform(x = region, CRSobj = CRS("+init=epsg:4326")) +#region <- readOGR(dsn = "data-raw/GIS_Maps", layer = "Regions") +#region <- spTransform(x = region, CRSobj = CRS("+init=epsg:4326")) +region <- st_read(dsn = "data-raw/GIS_Maps", layer = "Regions") usethis::use_data(region, overwrite = TRUE, compress = "xz") ## District -------------------------------------------------------------------- -district <- readOGR(dsn = "data-raw/Districts_Shapefiles_2019", +#district <- readOGR(dsn = "data-raw/Districts_Shapefiles_2019", +# layer = "Districts and TC as 2020") +district <- st_read(dsn = "data-raw/Districts_Shapefiles_2019", layer = "Districts and TC as 2020") usethis::use_data(district, overwrite = TRUE, compress = "xz") ## Ward ------------------------------------------------------------------------ -ward <- readOGR(dsn = "data-raw/2012 Wards Shapefiles", +#ward <- readOGR(dsn = "data-raw/2012 Wards Shapefiles", +# layer = "TZwards") +#ward <- spTransform(x = ward, CRSobj = CRS("+init=epsg:4326")) +ward <- st_read(dsn = "data-raw/2012 Wards Shapefiles", layer = "TZwards") -ward <- spTransform(x = ward, CRSobj = CRS("+init=epsg:4326")) usethis::use_data(ward, overwrite = TRUE, compress = "xz") ## Village --------------------------------------------------------------------- -village <- readOGR(dsn = "data-raw/2002/Tanzania_Village_EA_2002_region", - layer = "Tanzania_Village_EA_2002_region") -village <- spTransform(x = village, CRSobj = CRS("+init=epsg:4326")) +#village <- readOGR(dsn = "data-raw/2002/Tanzania_Village_EA_2002_region", +# layer = "Tanzania_Village_EA_2002_region") +#village <- spTransform(x = village, CRSobj = CRS("+init=epsg:4326")) +village <- st_read(dsn = "data-raw/2002/Tanzania_Village_EA_2002_region", + layer = "Tanzania_Village_EA_2002_region") village$STREET <- village$STREET %>% str_remove_all(pattern = "\xf4A\xf6|\xf4B\xf6|\xc6") usethis::use_data(village, overwrite = TRUE, compress = "xz") diff --git a/data/district.rda b/data/district.rda index 586ac84..9638aee 100644 Binary files a/data/district.rda and b/data/district.rda differ diff --git a/data/livelihood_zone.rda b/data/livelihood_zone.rda index 8003597..965fb4b 100644 Binary files a/data/livelihood_zone.rda and b/data/livelihood_zone.rda differ diff --git a/data/region.rda b/data/region.rda index 451866b..74fc9f7 100644 Binary files a/data/region.rda and b/data/region.rda differ diff --git a/data/ruminant_population.rda b/data/ruminant_population.rda index 86a3d08..c8b2852 100644 Binary files a/data/ruminant_population.rda and b/data/ruminant_population.rda differ diff --git a/data/village.rda b/data/village.rda index 2cd5433..52c5295 100644 Binary files a/data/village.rda and b/data/village.rda differ diff --git a/data/ward.rda b/data/ward.rda index 045dd18..6914317 100644 Binary files a/data/ward.rda and b/data/ward.rda differ diff --git a/man/figures/logo.svg b/man/figures/logo.svg new file mode 100644 index 0000000..bfc4d06 --- /dev/null +++ b/man/figures/logo.svg @@ -0,0 +1,14 @@ + + Flag of Tanzania + + + + + + + + + + + + diff --git a/man/ruminant_population.Rd b/man/ruminant_population.Rd index bc5a16c..d9b3c7d 100644 --- a/man/ruminant_population.Rd +++ b/man/ruminant_population.Rd @@ -20,9 +20,5 @@ ruminant_population } \description{ Ruminant population in Tanzania -} -\examples{ -ruminant_population - } \keyword{datasets}