knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.width = 10, fig.height = 8, message = FALSE, warning = FALSE )
library(regionaldrivers) library(magrittr) library(raster)
SSCT_data
is loaded with the package.
Here is what 10 random rows of it looks like:
SSCT_data %>% dplyr::sample_n(10) %>% knitr::kable(digits = 3, format = "html", caption = "SSCT_data") %>% kableExtra::kable_styling(bootstrap_options = c("hover", "condensed")) %>% kableExtra::scroll_box(width = "7in", height = "5in")
We extract some geology data from CA_geology
and SSCT_data
.
SSCT_labelled_points <- sp::SpatialPoints( cbind(SSCT_data$POINT_X, SSCT_data$POINT_Y), proj4string = sp::CRS('+proj=longlat +datum=WGS84') ) SSCT_labelled_points <- sp::spTransform(SSCT_labelled_points, crs(CA_geology)) SSCT_data <- SSCT_data %>% dplyr::mutate( geology = (SSCT_labelled_points %over% CA_geology) %>% dplyr::pull(GENERAL) ) head(SSCT_data)
We perform the bootstrapping using bootstrap_freq()
.
We use set.seed()
to ensure reproducibility of the random process.
set.seed(1789) l_boot <- bootstrap_freq(SSCT_data %>% dplyr::select(c("ward", "geology")) %>% na.omit())
plotly::ggplotly( plot_bootstrap_pvalue(l_boot), tooltip = c("channel_type", "geology", "p.value") )
plotly::ggplotly( plot_bootstrap_probability(l_boot), tooltip = c("channel_type", "number_groupings", "probability") )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.