# \donttest{
library(sf)
library(dplyr)
# These are SYNTHETIC agricultural FSS data
data(ifs_dk) # Census data
# Create spatial data
ifg = fssgeo(ifs_dk, locAdj = "LL")
ress = c(1,5,10,20,40, 80, 160)*1000
# Gridding Utilized agricultural area (UAA)
ifl = gridData(ifg, "UAA",res = ress)
# Create a multi-resolution grid only with farm number as confidentiality rule, then plot results
himg = multiResGrid(ifl, checkReliability = FALSE, suppresslim = 0)
himg = inspireID(himg)
# It is easy to modify the country information afterwards
if (require(giscoR)) {
borders = gisco_get_nuts(nuts_level = 0, epsg = 3035)
himg1 = inspireID(himg, borders)
himg2 = st_join(himg, borders %>% select(CNTR_CODE), join = st_nearest_feature)
himg2 = inspireID(himg2, cntrCol = "CNTR_CODE")
# The border issues cause some grid cell to be classified as German, although
# all data is from Denmark
table(substr(himg1$ID, 1, 2))
}
# }
Run the code above in your browser using DataLab