Submitted by Michael Butros
library(readr)
ff <- read.csv("forestFires.txt")
ff
library(sp)
library(dplyr)
# The contextual data
spatialCoords <- select(ff,long=x,lat=y)
# The behavioral data
firesData <- select(ff,ano2000)
coordRefSys <- CRS("+proj=longlat +ellps=WGS84")
## Warning in showSRID(uprojargs, format = "PROJ", multiline = "NO", prefer_proj
## = prefer_proj): Discarded datum Unknown based on WGS84 ellipsoid in Proj4
## definition
fires2000 <- SpatialPointsDataFrame(spatialCoords,
firesData,
proj4string = coordRefSys)
fires2000[1:3,]
bbox(fires2000)
coordinates(fires2000)[1:3,]
summary(fires2000)
library(ggmap)
library(tibble)
library(ggplot2)
mapPT <- get_map("Portugal", zoom=7)
d4plot <- as_tibble(cbind(coordinates(fires2000),burnt=fires2000$ano2000))
ggmap(mapPT) +
geom_point(data=filter(d4plot,burnt==1),aes(x=long,y=lat),col="orange")
## Warning: Removed 2 rows containing missing values (geom_point).
