Please help us to improve R-exercises: Did you like this set? (1 star = no, not at all; 5 stars = yes, very much!) How difficult was this for you? (1 star=easy, 10 stars=hard) Are you a beginner (1 star), intermediate (2 stars) or advanced (3 stars) R user?

# Solutions

## Step Up Your Dashboard With Shinydashboard – Part 1: Solutions

Please help us to improve R-exercises: Did you like this set? (1 star = no, not at all; 5 stars = yes, very much!) How difficult was this for you? (1 star=easy, 10 stars=hard) Are you a beginner (1 star), intermediate (2 stars) or advanced (3 stars) R user?

## Specialize in Geo-Spatial Visualizations With Leaflet – Part 2: Solutions

Below are the solutions to these exercises on Leaflet Package – Part 2.” # load package library(leaflet) #################### # # # Exercise 1 # # # #################### leaflet() %>% setView(lng = -47.4, lat = 39.75, zoom = 3) %>% addTiles() %>% addEasyButton( easyButton( icon = shiny::icon(“home”), title= “Reset Zoom”, onClick = JS( c(“function(btn, map) {map.setView(new […]

## Basic Generalized Linear Modeling – Part 4: Solutions

Below are the solutions to these exercises on “GLM – Part 4.” if (!require(car)){install.packages(car, dep=T)} library(car) if (!require(MuMIn)){install.packages(MuMIn, dep=T)} ## Warning: package ‘MuMIn’ was built under R version 3.4.4 library(MuMIn) spider<-read.csv(file.choose()) ############### # # # Exercise 1 # # # ############### # Visualise the data table(spider$PA) ## ## 0 1 ## 9 10 op <- […]

## Specialize in Geo-Spatial Visualizations With Leaflet – Part 1: Solutions

Below are the solutions to these exercises on ” The Leaflet Package – Part 1.” # load package library(leaflet) #################### # # # Exercise 1 # # # #################### leaflet() %>% addProviderTiles(provider = “Esri.WorldGrayCanvas”) #################### # # # Exercise 2 # # # #################### leaflet() %>% addProviderTiles(provider = “Esri.WorldGrayCanvas”) %>% setView(lng = 8.2275, lat = […]

## Harvesting Data From the Web With Rvest: Solutions

Below are the solutions to these exercises on ” Harvesting Data From the Web With Rvest.” # load package library(rvest) #################### # # # Exercise 1 # # # #################### webpage <- read_html(x = “https://money.cnn.com/data/us_markets/”) #################### # # # Exercise 2 # # # #################### html_session(“https://money.cnn.com/data/us_markets/”) ## <session> https://money.cnn.com/data/us_markets/ ## Status: 200 ## Type: text/html; […]

## Basic Generalized Linear Modeling – Part 3: Solutions

Below are the solutions to these exercises on “GLM – Part 3.” Please note, you need to execute the answer in this exercise, along with the solutions of Basic GLM Exercises – Part 2 here. ############### # # # Exercise 9 # # # ############### Road.nb1 <- glm.nb(TOT.N ~ OPEN.L + MONT.S + POLIC + […]

## Basic Generalized Linear Modeling – Part 2: Solutions

Below are the solutions to these exercises on “GLM – Part 2.” if (!require(car)){install.packages(car, dep=T)} library(car) ############### # # # Exercise 1 # # # ############### rm(list=ls()) Road<-read.csv(file.choose()) plot(Road$D.PARK,Road$TOT.N,xlab=”Distance to park”, ylab=”Road kills”) ############### # # # Exercise 2 # # # ############### Road.glm1<-glm(TOT.N~D.PARK,family=poisson,data=Road) summary(Road.glm1) ## ## Call: ## glm(formula = TOT.N ~ D.PARK, family […]

## Fighting Factors With Cats: Solutions

Below are the solutions to these exercises on “Fighting Factors With Cats.” #################### # # # Exercise 1 # # # #################### library(gapminder) library(forcats) # Solution based on version: packageVersion(“forcats”) ## [1] ‘0.3.0’ packageVersion(“gapminder”) ## [1] ‘0.3.0’ gp <- gapminder fct_count(gp$continent) ## # A tibble: 5 x 2 ## f n ## <fct> <int> ## […]

## Basic Generalized Linear Modeling – Part 1: Solutions

Below are the solutions to these exercises on “Generalized Linear Modeling – Part 1.” if (!require(car)){install.packages(car, dep=T)} library(car) if (!require(MuMIn)){install.packages(“MuMIn”, dep=T)} ## Warning: package ‘MuMIn’ was built under R version 3.4.4 library(MuMIn) ############### # # # Exercise 1 # # # ############### #load data and check data structure gotelli<-read.csv(file.choose()) require(car) scatterplotMatrix(~Srich + Habitat * Latitude […]