[R] the error in DoSimulateRF function
Ben Bolker
bolker at ufl.edu
Sun Mar 14 21:25:27 CET 2010
maddy <madhura1301 <at> gmail.com> writes:
>
>
> Hello,
>
> I did not understand what you mean by updating the system. I am new
> user of R and I downloaded R a few days ago. Also I installed the
> required packages for my program(geoR, randomFields), there was just
> one version I could see for the packages.
> The code I am using is as follows
>
Where did you get the advice to set .Random.seed that way?
You probably wanted set.seed() [see ?set.seed] instead. Removing
.Random.seed, or not setting in the first place, should make
things work.
Here's what I did, from a clean R session:
get_spherical_map <- function(N,phi) {
sim<-grf(N*N,grid="reg",cov.model="spherical",cov.pars=c(1,phi),method="RF")
sim$data <- (sim$data - mean(sim$data)) / sd(sim$data)
local <- array(sim$data, dim=c(N,N))
}
library(geoR)
tmp <- get_spherical_map(300,0.25)
## works
.Random.seed <- 1
tmp <- get_spherical_map(300,0.25)
## error
rm(.Random.seed)
tmp <- get_spherical_map(300,0.25)
## Warning message:
## In grf(N * N, grid = "reg", cov.model = "spherical", cov.pars = c(1, :
## .Random.seed not initialised. Creating it with by calling runif(1)
More information about the R-help
mailing list