https://github.com/cran/agricolae
Tip revision: 43f53bd983067301f9e8715e1b7c408ff3347c7e authored by Felipe de Mendiburu on 04 November 2013, 00:00:00 UTC
version 1.1-5
version 1.1-5
Tip revision: 43f53bd
wxyz.R
`wxyz` <-
function(model,x,y,z) {
datos<-data.frame(x,y,z)
lista<-by(datos[,3],datos[,1:2],mean)
pp<-as.matrix(lista)
m<-nrow(pp)
n<-ncol(pp)
x1<-rownames(pp)
xx<-as.numeric(x1)
y1<-colnames(pp)
yy<-as.numeric(y1)
z1<-rep(NA,m*n)
dim(z1)<-c(m,n)
for (i in 1:m){
for (j in 1:n){
if( (length(pp[i,j][[1]][3]) > 0) && !(is.na(pp[i,j][[1]][3]) )) z1[i,j]<- pp[i,j][[1]][3]
else z1[i,j]<-predict(model,data.frame(x=xx[i],y=yy[j]))
}
}
dimnames(z1)<-list(x1,y1)
return(z1)
}