Hello everyone. I would kindly request your help concerning how R converts data between different structrures. In the following example please keep attention on the following two 1) I create f <- GaussRF(x=x, y=y, model=model, grid=TRUE,param=c(mean, variance, nugget, scale, alpha)) with image(x,y,f) and image(f) I get exactly the same image. then 2)I try to store f inside a raster layer using: r <- setValues(r,as.matrix(f)) then comes the tricky part. I am trying to use image again and get the same output as the ouput I got by image(f). I tried image(as.matrix(getValues(r))) which give a completely different output. image function expects a matrix... but for some reason as.matrix(getValues(r)) returns a huge vector :( also tried as.matrix(getValues(r),ncol=ncol(r),nrow=nrow(r)) to force as.matrix to return the appropriate matrix but this also failed and I only got back a vector again Could you please let me understand why this might happening? Best Regards Alex P.S Below you will find part of my code. ...................(lines omitted, declarations) x <- seq(1, dimx, step) y <- seq(1, dimy, step) f <- GaussRF(x=x, y=y, model=model, grid=TRUE,param=c(mean, variance, nugget, scale, alpha)) # image(x, y, f) Displays the matrix # f is a 2x2 matrix of dimension (x,y) r <- raster(nrow=dimx, ncol=dimy) r <- setValues(r,as.matrix(f)) # getValues(r) [[alternative HTML version deleted]]