Skip to content
Open
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
5 changes: 2 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 0 additions & 3 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
27 changes: 14 additions & 13 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -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 <img src="man/figures/logo.svg" width="200px" align="center" />

<!-- badges: start -->
[![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)
<!-- badges: end -->

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.
Expand All @@ -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)
```

Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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))
```

27 changes: 17 additions & 10 deletions data-raw/processMaps.R
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Binary file modified data/district.rda
Binary file not shown.
Binary file modified data/livelihood_zone.rda
Binary file not shown.
Binary file modified data/region.rda
Binary file not shown.
Binary file modified data/ruminant_population.rda
Binary file not shown.
Binary file modified data/village.rda
Binary file not shown.
Binary file modified data/ward.rda
Binary file not shown.
14 changes: 14 additions & 0 deletions man/figures/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 0 additions & 4 deletions man/ruminant_population.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.