Skip to content

Latest commit

 

History

History
50 lines (35 loc) · 1.25 KB

README.md

File metadata and controls

50 lines (35 loc) · 1.25 KB

sfExtras

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 at the University of Chicago. The code in this package originates from documentation from sf and 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 with:

# install.packages("remotes")
remotes::install_github("spatialanalysis/sfExtras")

Example

Load the sfExtras library, then start making contiguity weights:

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:

rook_nb <- st_as_nb(ncovr_rook)