-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathREADME.Rmd
56 lines (43 loc) · 1.46 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
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# sfExtras
<!-- badges: start -->
<!-- badges: end -->
The goal of sfExtras is to provide a nice interface to sf-style functions for spatial
autocorrelation functionality in R. This package was developed for the R Spatial Workshop
at the [Center for Spatial Data Science](https://spatial.uchicago.edu/) at the University
of Chicago. The code in this package originates from documentation
from [sf](https://github.com/r-spatial/sf) and [spdep](https://github.com/r-spatial/spdep).
The goal is to create a nice function API interface for spatial analysts
to use with the sf and spdep packages.
**Disclaimer**: This package is still heavily under development, so use at your own risk.
PRs and issues are welcome.
## Installation
You can install the development version from [GitHub](https://github.com/) with:
``` r
# install.packages("remotes")
remotes::install_github("spatialanalysis/sfExtras")
```
## Example
Load the sfExtras library, then start making contiguity weights:
```{r weights, eval=FALSE}
library(sf)
library(sfExtras)
library(geodaData)
ncovr_rook <- st_rook(ncovr)
ncovr_queen <- st_queen(ncovr)
```
Convert into **nb** class for use with the spdep package:
```{r as_nb, eval=FALSE}
rook_nb <- st_as_nb(ncovr_rook)
```