Hello everyone.
I am trying to build up understanding in R by trying to develop just some 
simple 
scenarios.

I would like to explain you what I am trying to do and what I did so far.

I would like to put inside a RasterLayer (raster package) a Gaussian field (for 
given covariance) using  grf function (geoR package)

1. First I created a Raster Layer object
r <- raster()  # Default values are ok
2. Then I set some values to test how  if setValues worked
r <- setValues(r,1:ncell(r)/100) # Every cell of the RasterLayer takes as data 
its cell number/100.
3.  Tested that 2 works with 
getValuesBlock(r,1,nrow(r),1,ncol(r)) 
4. Then I tried to generate a Gaussian random field for given covariance 
parameters using grf.
temp <- grf(1,nx=nrow(r),ny=ncol(r), cov.pars=c(1, .25)) # Note: The first 
input 
parameter in grf is locations. At first I tried nrow(r)*ncol(y) but I got the 
ouput that this will produce 15,5 Gb of data :(. I just wanted to created a x*y 
array of this data. Then I tried to pass the nrow(r) and ncol(r) to the nx and 
ny arguments. Now this seems ok to me.
5. Final step is to set the values created in 4th step to the RasterLayer 
object 
that was created at first step.
 r <- setValues(r,temp) # Unfortunately this ends with the message: Error in 
setValues(r, temp) : values must be a vector

and at this point I am completely stuck :(

I would like to request some of your kindness to help me unstuck

Best Regards
Alex.


      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to