TransWikia.com

Areal interpolation with mostly missing data in R

Geographic Information Systems Asked on July 25, 2021

I am attempting to preform an areal interpolation using R with the sf package’s st_interpolate_aw.

Of note, my sampling scheme for my areal units is such that I have many missing values. When using the st_interpolate_aw, I am only returned missing values. Ideally, I am looking for predicted values based on these missing data. See the reprex below:

library(sf)
library(tmap)
url="https://www2.census.gov/geo/tiger/GENZ2018/shp/cb_2018_us_zcta510_500k.zip"
tdir=tempdir()
if(file.exists(paste(tdir,"/cb_2018_us_zcta510_500k.shp",sep=""))==F){
  download.file(url,destfile = file.path(tdir,"ZCTAs.zip"))
  unzip(file.path(tdir,"ZCTAs.zip"),exdir=tdir)}
ZCTAs=read_sf(paste(tdir,"/cb_2018_us_zcta510_500k.shp",sep=""))
df1 = data.frame(val=seq(1:33144))
df1$val[c(501:33144)]=NA
ZCTAs=cbind(ZCTAs,df1)

g = st_make_grid(ZCTAs, n = c(50,50))
test=st_interpolate_aw(ZCTAs["val"], g, extensive = FALSE)
tm_shape(test)+tm_fill(col="val")

Is there a better way to make areal level predictions with many missing values using R?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP