[R] runif error - maximum limit?

Diann Prosser dprosser at usgs.gov
Wed Mar 21 20:41:06 CET 2012


Dear all,

I am receiving the error below, I think because my n is exceeding the
allowable limit for a vector.
Can anyone confirm, and help with the following questions?

The function and error:
> stPte8 <- rtrunc(rnorm, nx * ny * nsimu, linf=0, mean=as.vector(PTmn),
> sd=as.vector(PTsd))
Error in runif(n, min = pinf, max = psup) : invalid arguments

My total n is calculated by:
nx=4053, ny=4848, nsimu=1000,
n = nx*ny*nsimu = 19,648,994,000

I believe the maximum size of a vector is 2^31-1 (2,147,483,647) - clearly
smaller than my n.

I have done some initial reading about how to deal with large datasets in R,
with reference to bigmemory and ff. For anyone who has experience in this,
would you have advice regarding using these packages as opposed to creating
a work-around such as reducing the size of the matrix (the ny by nx),
batching the simulations, then piecing them back together outside of R
(ArcGIS)?

Thanks for any insights you might have.

----------------
> sessionInfo()
R version 2.14.2 (2012-02-29)
Platform: x86_64-pc-mingw32/x64 (64-bit) -- 88GB RAM

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] MASS_7.3-17      rgdal_0.7-8      raster_1.9-70    sp_0.9-97       
mc2d_0.1-12      mvtnorm_0.9-9992

loaded via a namespace (and not attached):
[1] grid_2.14.2    lattice_0.20-0

--
View this message in context: http://r.789695.n4.nabble.com/runif-error-maximum-limit-tp4493486p4493486.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list