---
title: "Comparison to spdep and pysal"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{spdep-and-pysal}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  echo = FALSE,
  comment = "#>"
)
library(magrittr)
fp <- system.file("extdata", "lookups.yml", package = "sfdep")
df <- yaml::read_yaml(fp, error.label = "")
```

## Global Statistics

Measures of global spatial autocorrelation.

```{r}
tibble::enframe(df$global_stats) %>% 
  tidyr::unnest_wider(value) %>% 
  dplyr::mutate(pysal = ifelse(is.na(pysal), "", pysal)) %>%
  knitr::kable()
```

## Local Indicators of Spatial Association

Measures of local spatial autocorrelation. 

```{r}
df$lisas %>% 
  tibble::enframe() %>% 
  tidyr::unnest_wider(value) %>% 
  dplyr::mutate(pysal = purrr::map_chr(pysal, ~stringr::str_c(.x, collapse = ", "))) %>% 
  knitr::kable()
```

### Not implemented

Functions present in Pysal that are not implemented in sfdep.

```{r}
df[["not implemented"]] %>% 
  tibble::as_tibble() %>% 
  dplyr::rename(`function` = value) %>% 
  knitr::kable()
```

