开发者

How to create a grid cell and average point data per each cell in R?

I have a a big dataframe w开发者_如何学Cith latitude, longitude and different variables for each point. It looks something like this:

df <- data.frame = (plot = c("A","A","A","A","A","B","B","B","B","B","C","C","C","C","C"),
latitude =c(48,48,48,48,48,49,49,49,49,49,50,50,50,50,50),
longitude = c(7,7,7,7,7,8,8,8,8,8,9,9,9,9,9),
class = c(0,2,0,1,1,3,1,1,0,0,2,1,2,0,1))

For now I used ggplot and ggmap to plot this and the map looks like this:

How to create a grid cell and average point data per each cell in R?

I want to create a grid cell instead and then average all the plots within one cell, but with a minimum threshold of number of plots per cell. I guess the starting point is to use raster but I am not sure where to go from there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜