Dear Sir,
When I looked at the sent file in my mail box , the mail seems ok but the one i get it back from r-sig-geo@stat.math.ethz.ch it was completely meshed up. I am sorry for that.
Now I am sending a copy of my code again:
A<-read.table(file.choose(new=FALSE), sep = ",",skip=1,header=FALSE)
names(A) <- c("S.N","x", "y", "B1","B2","B3","B4")
library(sp)
library(gstat)
coordinates(A) = ~x+y
C<-variogram(B1~x+y+x*y+x*x+y*y,A,cutoff=700,width=12,alpha=0,tol.hor=90)
model.1 <- fit.variogram(C,vgm(4,"Sph",800,add.to=vgm(1,"Sph",40,nugget=.9)))
plot(C,model=model.1,pch=1,col=”blue”,lty=1,lwd=2,plot.numbers=F,xlab=list("Distance(h) [m]",font=1,col="black"),ylab= list(expression("Semivariogram [-]"^2), font=1,col="black"),ylim = c(0,6, by=1), xlim = c(0,550, by=100))
Using the above code everything went ok. But I need to save the experimental semivariogram i.e (C) and then later utilize it to fit the model semivariogram for the same. So I first save it using the following code:
write.table(C, file = "expm_vario.csv", sep = ",", col.names = T,qmethod="double")
Then I used the following code to read the saved file expm_vario.csv and try to fit the model for it;
B<-read.table(file.choose(new=FALSE), sep = ",",skip=0,header=T)
class(B)=c("gstatVariogram","data.frame","numeric")
model.2<- fit.variogram(B,vgm(4,"Sph",500,add.to=vgm(1,"Sph",80,nugget=.9))) But I couldn't fit the model. Following was the error message I got: "Error in fit.variogram(B, vgm(4, "Sph", 500, add.to = vgm(1, "Sph", 80, : REAL() can only be applied to a 'numeric', not a 'integer' "The problem seems to be the numeric and integer values but I couldn't figured it out. Any help will be greatly appreciated!
Regards,
Pujan
_________________________________________________________________
E-mail for the greater good. Join the i’m Initiative from Microsoft.
ood
[[alternative HTML version deleted]]