library(dggridR)
data(dgquakes)
#Construct a grid with cells about ~1000 miles wide
dggs <- dgconstruct(spacing=1000,metric=FALSE)
dgquakes$cell <- dgGEO_to_SEQNUM(dggs,dgquakes$lat,dgquakes$lon)$seqnum
#Get grid cells for the earthquakes identified
grid <- dgcellstogrid(dggs, dgquakes$cell)
Run the code above in your browser using DataLab