Exercise 3. For this exercise use the meuse data set from the sp package.The data set contains the heavy metal concentrations sampled at locations along the flooded banks of the Meuse river. Use geom point() to plot the spatial coordinates, x and y. Then color the points according to the logarithm of the lead concentrations (lead).
R code with comments (all statements starting with # are comments and can be removed)
#install the package sp for the firs time
install.packages('sp')
#load the package sp
library(sp)
#load the package ggplot2
library(ggplot2)
#load the data meuse
data(meuse)
#check some records of the dataset
head(meuse)
#plot the spatial coordinates, x and y
p <-ggplot(meuse, aes(x, y))+ geom_point()
#Then color the points according to the logarithm of the lead
concentrations
p+aes(colour =log(lead))
# get this graph
Get Answers For Free
Most questions answered within 1 hours.