[R] gls and memory allocation
Hi all, A two part quick question regarding gls 1) I'd like to pass a formula to gnls from a gam(mgcv package). Is there a quick way to do this? I tried using gnls(gam$call$formula, data=df, correlation=AC1) but it keeps outputting a message to the effect that I need x ~ y etc as the formula. I realize now that the $formula part of the gam is only sending x ~ s(y) and that this is probably the problem, but I cannot seem to find any part of the gam object that would pass the smooth terms as part of the formula. Any ideas or suggestions? 2) While running a gls with a rather large dataset (~ 13000 data points) it cannot seem to allocate ~ 685 MB for the vector. I've got a 2G RAM on windows XP (32 -bit I guess). I've cleared the memory as best I can, and specified the max allowable in the target line (i.e. --max-mem-size = 2000MB) but still it does not want to run. Am I just running out of RAM? or should R be able to handle that size vector, and I just need to clean up the code? Thanks, Dave __ 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.
Re: [R] spatialpixelsdataframe
Thanks Paul, Will keep that in mind for my next query :-) Paul Hiemstra wrote: Dave Depew wrote: I have a spatialpixelsdataframe containing bathymetry data. Is it possible to save this as something similar to the meuse.grid so it can be loaded without having to run the spatial interpolation each time the script is called? I don't see a straightforward method in the sp documentation. __ 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. Hi Dave, You can save the SpatialPixelsDataFrame to a file using: save(SPDF_object, file =test.rda) And reload it with: load(test.rda) This is not specific to the sp-package. These kinds of questions are better to post to the r-sig-geo mailing list. Paul __ 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.
[R] spatialpixelsdataframe
I have a spatialpixelsdataframe containing bathymetry data. Is it possible to save this as something similar to the meuse.grid so it can be loaded without having to run the spatial interpolation each time the script is called? I don't see a straightforward method in the sp documentation. __ 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.
[R] memory issues
Hi all, I've read the R for windows FAQ and am a little confused re: memory.limit and memory.size to start using R 2.6.2 on WinXP, 2GB RAM, I have the command line sdi --max-mem-size=2047M Once the Rgui is open, memory.limit() returns 2047, memory.size() returns 11.315, and memory.size(max=T) returns 19.615 Shouldn't memory.size(max=T) return 2047? Upon running several operations involving kriging (gstat package, original data file 3 variables, 12000 observations) the program runs out of memory memory.c, line 57: can't allocate memory in function m_get() Error in predict.gstat(fit.uk, newdata = EcoSAV.grid.clip.spxdf, debug.level = -2, : m_get Immediately following this, memory.limit() returns [1] -Inf Warning message: In memory.limit() : no non-missing arguments to max; returning -Inf memory.size() returns 24.573. memory.size(max=T) returns 46.75 To my untrained eye, it appears that R is not being allowed access to the full memory limit specified in the cmd lineif this is the case, how does one ensure that R is getting access to the full allotment of RAM? Any insight is appreciated... sessionInfo() R version 2.6.2 (2008-02-08) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices datasets tcltk utils methods base other attached packages: [1] maptools_0.7-7 foreign_0.8-23 gstat_0.9-43 rgdal_0.5-24 lattice_0.17-4 sp_0.9-23 svSocket_0.9-5 svIO_0.9-5 R2HTML_1.58svMisc_0.9-5 svIDE_0.9-5 loaded via a namespace (and not attached): [1] grid_2.6.2 tools_2.6.2 __ 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.
[R] memory issues
Hi all, I've read the R for windows FAQ and am a little confused re: memory.limit and memory.size to start using R 2.6.2 on WinXP, 2GB RAM, I have the command line sdi --max-mem-size=2047M Once the Rgui is open, memory.limit() returns 2047, memory.size() returns 11.315, and memory.size(max=T) returns 19.615 Shouldn't memory.size(max=T) return 2047? Upon running several operations involving kriging (gstat package, original data file 3 variables, 12000 observations) the program runs out of memory memory.c, line 57: can't allocate memory in function m_get() Error in predict.gstat(fit.uk, newdata = EcoSAV.grid.clip.spxdf, debug.level = -2, : m_get Immediately following this, memory.limit() returns [1] -Inf Warning message: In memory.limit() : no non-missing arguments to max; returning -Inf memory.size() returns 24.573. memory.size(max=T) returns 46.75 To my untrained eye, it appears that R is not being allowed access to the full memory limit specified in the cmd lineif this is the case, how does one ensure that R is getting access to the full allotment of RAM? Any insight is appreciated... sessionInfo() R version 2.6.2 (2008-02-08) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices datasets tcltk utils methods base other attached packages: [1] maptools_0.7-7 foreign_0.8-23 gstat_0.9-43 rgdal_0.5-24 lattice_0.17-4 sp_0.9-23 svSocket_0.9-5 svIO_0.9-5 R2HTML_1.58svMisc_0.9-5 svIDE_0.9-5 loaded via a namespace (and not attached): [1] grid_2.6.2 tools_2.6.2 __ 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.
[R] minimum distances
Hi, I have a question about computing shortest Euclidean distances between two data frames of spatial points... I have 2 dataframes (not yet converted to spatial class) Sewers-data.frame(x=c(10,20,35,50),y=c(100,150,200,300)) transect - data.frame(x=seq(from=0, to=50, by=1),y=seq(from=100, to=150, by=1)) I would like to be able to compute the shortest distance from the transect points the nearest sewer (Euclidean distance) I've tried a number of different loops, but so far ave had no luck. Any help would be appreciated __ 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.