I am an absolute beginner in analyzing geographic data with R.
I have a database with longitude and latitude of around a million buildings in a country. I would like to find the average density of those buildings. For that I have divided the whole country into several cells using Raster and applied projection with the appropriate proj4 profile. Now I want to check which buildings are coming under which cell to find the density.
> metersCoordinates <- totalMeterDatabase[,c("longitude","latitude")]
> coordinates(metersCoordinates) <- ~longitude+latitude
> r <- raster(ncols=6000, nrows=2000)
> r[] <- 0
> crs(r) <- "+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=6000 +y_0=2000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs"
> projection(r)
Could you please tell me how can I find it?