-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
76 lines (56 loc) · 2.15 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
messages = FALSE,
results = 'hide'
)
```
<!-- badges: start -->
[![R build status](https://github.com/jayrobwilliams/RWmisc/workflows/R-CMD-check/badge.svg)](https://github.com/jayrobwilliams/RWmisc/actions)
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/RWmisc)](https://CRAN.R-project.org/package=RWmisc)
[![codecov](https://codecov.io/gh/jayrobwilliams/RWmisc/branch/master/graph/badge.svg)](https://codecov.io/gh/jayrobwilliams/RWmisc)
[![License](http://img.shields.io/badge/license-GPL%20%28%3E=%203%29-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-3.0.html)
<!-- badges: end -->
# RWmisc
This package contains convenience functions I have written to help deal with
spatial data spread across multiple UTM zones and aggregating raster data to
overlapping polygons.
# Installation
To install the latest release on CRAN:
```{r cran-install, eval = FALSE}
install.packages("RWmisc")
```
You can install the latest development version from GitHub with:
```{r gh-install, eval = FALSE}
library(remotes)
install_github("jayrobwilliams/RWmisc")
```
# Examples
The functions contained in this package serve to make working with spatial data
on large scale easy, as when carrying out cross-national analyses with spatial
data. The function `projectUTM` can project `sf` and `sp` objects in latitude,
longitude coordinate reference systems, and can even re-project
already-projected objects in other projected coordinate reference systems.
```{r projectUTM}
library(sf)
library(RWmisc)
nc <- st_read(system.file("shape/nc.shp", package="sf"))
projectUTM(nc)
```
The `theme_rw` function is the minimalist theme I often use for figure in my
work. While it is useful for standard plots, it is an especially large
improvement over the `ggplot2` defaults for maps.
```{r theme_rw, fig.show = 'hold'}
library(ggplot2)
ggplot(aes(fill = BIR74), data = nc) +
geom_sf()
ggplot(aes(fill = BIR74), data = nc) +
geom_sf() +
theme_rw()
```