error using krige function

Hi, i am new to rstudio, and i tried the krige function. But i always got text warning "There were 50 or more warnings (use warnings() to see the first 50)" after i run my krige function and keep getting my var1.pred and var1.var to NA. Can someone pls help me? Thanks

This is not a standard function in R. Therefore please declare the package.
Have you looked at the warnings ?
There is likely a problem with the data you provide to this function, but, we can't see that to judge it.

Please read this guide to understand how to share representative data.

FAQ: How to do a minimal reproducible example ( reprex ) for beginners

hi, thanks for answering.
im sorry if my english and the format for sharing data is bad
i used this package :

library(ggplot2)
library(gstat)
library(sp)

I tried to do the kriging interpolation using the example data below. X and Y are the location coordinates. while Depth is the data that I have used to make kriging interpolation.

No X Y Depth
1 436162 9225207 72
2 421918 9228627 54
3 421796 9228805 66
4 425039 9226890 55
5 438778 9224380 60
6 428920 9219980 15
7 435402 9215807 72
8 444398 9218928 62
9 424909 9225120 55
10 430204 9225798 17

and the code is

koordinat <- read.csv("coba_koordinat432.csv")
coordinates(koordinat) = ~X+Y
plot(koordinat)
x.range <- as.integer(range(koordinat@coords[,1]))
y.range <- as.integer(range(koordinat@coords[,2]))
grd <- expand.grid(x=seq(from=x.range[1], to=x.range[2], by=200),
y=seq(from=y.range[1], to=y.range[2], by=200))
coordinates(grd) <- ~ x+y
gridded(grd) <- TRUE
plot(grd, cex=1.5)
points(koordinat, pch=1, col='red', cex=1)
variogcloud<-variogram(Depth~1, locations=koordinat, data=koordinat, cloud=TRUE)
plot(variogcloud)
semivariog<-variogram(Depth~1, locations=koordinat, data=koordinat)
plot(semivariog)
semivariog
model.variog<-vgm(psill=600, model="Exp", nugget=80, range=8675)
fit.variog<-fit.variogram(semivariog, model.variog)
plot(semivariog, fit.variog)
krig<-krige(formula=Depth ~ 1, locations=koordinat, newdata=grd, model=model.variog)
krig.output=as.data.frame(krig)
names(krig.output)[1:3]<-c("long","lat","var1.pred")

and after i run the code above, i got warning massage like this,

Warning messages:
1: In flat_str(content, breaks) : Coercing content to character
2: c(421779, 421979, 422179, 422379, 422579, 422779, 422979,....,etc

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.