We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Instead of selecting just grid cells with data using dgcellstogrid(), I would like to display the full grid, including cells with NA.
I tried doing this by replacing dgcellstogrid with dggearthgrid and then merging using merge(all=TRUE) but the result is a messed up grid.
dgcellstogrid
dggearthgrid
merge(all=TRUE)
Reproducible example using your vignette code:
library(dggridR) library(dplyr) dggs <- dgconstruct(spacing=1000, metric=FALSE, resround='down') data(dgquakes) dgquakes$cell <- dgGEO_to_SEQNUM(dggs,dgquakes$lon,dgquakes$lat)$seqnum cellcenters <- dgSEQNUM_to_GEO(dggs,dgquakes$cell) quakecounts <- dgquakes %>% group_by(cell) %>% summarise(count=n()) #** HERE replace dgcellstogrid() with dgearthgrid()** # grid <- dgcellstogrid(dggs,quakecounts$cell,frame=TRUE,wrapcells=TRUE) grid <- dgearthgrid(dggs, frame=TRUE, wrapcells=TRUE) # merge using all=T to include NAs grid <- merge(grid,quakecounts,by.x="cell",by.y="cell", all = TRUE) #PLOT countries <- map_data("world") p <- ggplot() + geom_polygon(data=countries, aes(x=long, y=lat, group=group), fill=NA, color="black") + geom_polygon(data=grid, aes(x=long, y=lat, group=group, fill=count), alpha=0.4) + geom_path (data=grid, aes(x=long, y=lat, group=group), alpha=0.4, color="white") + geom_point (aes(x=cellcenters$lon_deg, y=cellcenters$lat_deg)) + scale_fill_gradient(low="blue", high="red") p
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Instead of selecting just grid cells with data using dgcellstogrid(), I would like to display the full grid, including cells with NA.
I tried doing this by replacing
dgcellstogrid
withdggearthgrid
and then merging usingmerge(all=TRUE)
but the result is a messed up grid.Reproducible example using your vignette code:
The text was updated successfully, but these errors were encountered: