8000 doc: review get started vignette · FRBCesab/chessboard@8f7e9f4 · GitHub
[go: up one dir, main page]

Skip to content

Commit

Permalink
doc: review get started vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
ahasverus committed Sep 7, 2023
1 parent e2c1c04 commit 8f7e9f4
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions vignettes/chessboard.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,6 @@ matrix_to_edge_list(conn_matrix)
## Extending chessboard

`chessboard` has been built to be compatible with the following R packages:
[`adespatial`](https://sdray.github.io/adespatial/) (Dray _et al._ 2023),
[`spdep`](https://r-spatial.github.io/spdep/) (Bivand & Wong 2018),
[`igraph`](https://r.igraph.org/) (Csardi & Nepusz 2006),
[`sf`](https://r-spatial.github.io/sf/) (Pebesma 2018), and
Expand Down Expand Up @@ -629,6 +628,9 @@ sf::st_write(edges_sf, "edge_list.gpkg")
```


For more information about the package `sf`, please visit the
[manual](https://cran.r-project.org/web/packages/sf/sf.pdf).

\


Expand All @@ -645,17 +647,20 @@ gg_matrix(conn_matrix) +
theme(legend.position = "none")
```

For more information about the package `ggplot2`, please visit the
[manual](https://cran.r-project.org/web/packages/ggplot2/ggplot2.pdf).


\


### with `igraph`

The package `igraph` is commonly use to analyze network data. User can use the
function [`igraph::graph_from_data_frame()`] to convert the edge list created
function `igraph::graph_from_data_frame()` to convert the edge list created
with `chessboard` to an `igraph` object.

```{r 'to-igraph', fig.height=8, fig.width=8, fig.cap="Figure 13. igraph graph", out.width='80%'}
```{r 'to-igraph'}
# Convert edge list to igraph object ----
igraph_obj <- igraph::graph_from_data_frame(d = edges,
directed = TRUE,
Expand All @@ -665,12 +670,20 @@ igraph_obj <- igraph::graph_from_data_frame(d = edges,
class(igraph_obj)
print(igraph_obj)
```

Let's plot our network using `igraph`.

# Plot the graph w/ igraph ----
```{r 'plot-igraph', fig.height=8, fig.width=8, fig.cap="Figure 13. Network visualization w/ `igraph`", out.width='80%'}
# Plot the network w/ igraph ----
plot(igraph_obj)
```
For more information about the package `igraph`, please visit the
[manual](https://cran.r-project.org/web/packages/igraph/igraph.pdf).
\
Expand All @@ -680,6 +693,9 @@ plot(igraph_obj)
...
For more information about the package `spdep`, please visit the
[manual](https://cran.r-project.org/web/packages/spdep/spdep.pdf).
\
Expand All @@ -693,11 +709,6 @@ indicators of spatial association. **TEST**, 27, 716–748.
Csardi G & Nepusz T (2006) The igraph software package for complex network
research. **InterJournal, Complex Systems**, 1695, 1–9. <https://igraph.org/>.
Dray S, Bauman D, Blanchet G, Borcard D, Clappe S, Guénard G, Jombart T,
Larocque G, Legendre P, Madi N & Wagner HH (2023) adespatial: Multivariate
multiscale spatial analysis.
<https://cran-r-project.org/package=adespatial>.

Pebesma E (2018) Simple Features for R: Standardized support for spatial
vector data. **The R Journal**, 10, 439–446.
<https://doi.org/10.32614/RJ-2018-009>.
Expand Down

0 comments on commit 8f7e9f4

Please sign in to comment.
0