Interactive maps with leaflet
2022-08-16
Preface
Prerequisites
This book is intended as a non-comprehensive guide to developing interactive maps with leaflet and shiny and covers the methods that were used in developing the iTRAQI shiny app. Since this book does focus on the applied problem of developing the iTRAQI shiny app, it includes specific methods used there that may be otherwise tricky to find.
There is a very small amount of javascript and css used to add certain features to leaflet. I’m not an expert in either of these languages so will not explain in detail how they work but will link to the sources that may explain it better.
For a more comprehensive introduction to leaflet, see the leaflet documentation.
For a more comprehensive introduction to shiny, see the Mastering Shiny book
A beginner-to-intermediate level of R is assumed.
Below is a list of packages that will be used. You can run the code to install those that are missing on your system.
<- c(
pkgs "tidyverse",
"sf",
"sp",
"gstat",
"shiny",
"leaflet",
"raster",
"rmapshaper",
"RCurl",
"glue"
)
<- pkgs[!pkgs %in% installed.packages()]
required_packages
if (length(required_packages) > 0) {
cat("Installing the following packages: \n", paste0(required_packages, collapse = ", "))
install.packages(required_packages)
else {
} cat("All required packages already installed!")
}