[R-sig-Geo] problems with predict() in raster package
Häring, Tim (LWF)
Tim.Haering at lwf.bayern.de
Thu Feb 3 10:31:50 CET 2011
Hello,
I get an error message when using the predict function (raster package) with a GLM and a rasterStack.
Did somebody have the same error message or can give me a hint what I am doing wrong.
> dv <- raster("dv.sgrd")
> fpi <- raster("fpi.sgrd")
> hut <- raster("hut.sgrd")
> train <- read.dbf("train.dbf")
> str(train)
'data.frame': 2574 obs. of 4 variables:
$ id : int 26 32 51 71 77 82 97 110 112 118 ...
$ dv: num 0.507 0.454 0.51 0.422 0.465 ...
$ fpi: num 0.968 1.396 0.974 1.343 1.412 ...
$ hut: num 0.465 0.723 0.662 0.4 0.742 ...
- attr(*, "data_types")= chr "N" "N" "N" "N"
> myglm <- glm(dv ~ fpi + hut, train, family=gaussian())
> r10 <- stack(fpi, hut)
> r10
class : RasterStack
nlayers : 2
nrow : 9736
ncol : 7762
ncell : 75570832
projection : NA
min value : NA NA
max value : NA NA
extent : 4494280, 4571900, 5446480, 5543840 (xmin, xmax, ymin, ymax)
resolution : 10, 10 (x, y)
> p <- predict(object = r10, model = myglm, filename='pr10', progress='', na.rm = FALSE, overwrite = TRUE)
Error in endrow - nrow : non-numeric argument to binary operator
Thank you very much
TIM
---------------------------------------------
Tim Häring
Bavarian State Institute of Forest Research
Department of Soil and Climate
Hans-Carl-von-Carlowitz-Platz 1
D-85354 Freising
E-Mail: tim.haering at lwf.bayern.de
http://www.lwf.bayern.de
More information about the R-sig-Geo
mailing list