How-to-Spatial-Modeling-with-R

Author

FG

Published

October 26, 2022

Prerequisites

This ice-breaking activity to spatial modeling with R includes two case studies:

  • Oregon spotted frog habitat study
  • A type of cancer spread in Scotland

It is required a good manner of RStudio and a little practice in making plots with {ggplot2}.

To set up install the following packages:

If these packages are missing in your RStudio they would need to be installed.

Please choose between {OpenStreetMap} and {ggmap}, {OpenStreetMap} has some extra Java requirement and it is not always available for the most updated versions of Mac.

my_packages <- c("tidyverse","ggthemes",
                 "maptools","OpenStreetMap","ggmap",
                 "spdep","sf","spocc",
                 "dismo","SpatialEpi")

install.packages(my_packages, repos = "http://cran.rstudio.com")

install.packages("remotes")
remotes::install_github("fgazzelloni/oregonfrogs")

The GitHub repository for this workshop is here: https://github.com/Fgazzelloni/How-to-Spatial-Modeling-with-R

Once installed the packages go to the GitHub repo above, You can fork the repository onto your RStudio, or copy and paste the code directly. Another option is to use {usethis} and some of its handling functions, for open the project in your machine.

Once set go to the /data folder and load the RData in the environment. It will make things easier as you don’t need to run some chucks of code which will require some time to compute, and for this reason are set to eval = false.

For any questions please email: