Re: [R-sig-Geo] Help with rgdal on MACOS

2010-12-22 Thread Agustin Lobo
Actually, more alternatives: 3. Suggested by Ralf Strasse: Install Xcode tools from Apple (is recommended anyway for many applications). This will install several compilers.Afterwards installing from source should work fine. http://developer.apple.com/technologies/tools/xcode.html And also select

Re: [R-sig-Geo] Converting array into raster brick

2010-12-22 Thread Christian Kamenik
Works like a charm - awesome! Many thanks, Christian Christian, You should also be able to do this: out<- setValues(x, xx) (where x is a RasterBrick and xx a matching 3 dimensional array) Robert On Wed, Dec 22, 2010 at 3:06 AM, Christian Kamenik wrote: Dear all, I replaced my layer-by

[R-sig-Geo] Help with rgdal on MACOS

2010-12-22 Thread Agustin Lobo
Dea all, Quite a number of students will be using MAC for a course in which we will make use of rgdal and raster. As I do not have an easy access to MAC machines and I've found quite a number of different options, I'm seeking some clarifications. Students will have gdal and other dependencies ins

Re: [R-sig-Geo] gridded time series analysis

2010-12-22 Thread Advait Godbole
That works Robert, thanks. There is still the issue of NA values. some grid cells have all values in the time series as missing (these are cells over the ocean, to make physical sense). Is there a way to disregard them in the calculation entirely? lm does have a na.action argument but it does not s

[R-sig-Geo] gridded time series analysis, using plyr

2010-12-22 Thread Advait Godbole
Dear Hadley, Starting this in a new thread since I had tried something to that effect like so: After: datCoef = adply( as.array(s_crop) , 1:2 , function(x ) { resp = x[1:120] expl = x[121:240] mdl =

Re: [R-sig-Geo] img file

2010-12-22 Thread Nick Matzke
Thanks!! I did an update of raster before our previous emails, but apaprently it didn't take, even after: > rm(list=ls(all=TRUE)) > > Close R& save workspace (answer = yes) ...what it took was (at Mac Terminal): == 486 cd /Library/Frameworks/R.framework/Versions/2.10/Resources/li

Re: [R-sig-Geo] gridded time series analysis

2010-12-22 Thread Hadley Wickham
On Wed, Dec 22, 2010 at 12:39 PM, Advait Godbole wrote: > Dear Members, > > I was able to find a solution after some deliberation and posting it here > for the benefit of forum members. > > To recap, my data was in the form of 2 netCDF files, each of dimension 356 x > 507 x 120 (lat,lon,time). I w

Re: [R-sig-Geo] gridded time series analysis

2010-12-22 Thread Advait Godbole
Dear Robert, Sorry about that - will incorporate an example in future. I tried the calc method and it is definitely much simpler! if "s_crop" is my raster stack for the following: s_crop <- stack(emitraster_crop,rcmraster_crop) fun <- function(x) { resp = x[1:120] expl = x[121:240] mdl =

Re: [R-sig-Geo] gridded time series analysis

2010-12-22 Thread Robert J. Hijmans
Advait, When asking for help, please provide a self-contained example whenever possible, as below. library(raster) v1 <- matrix(rep(1:12, 16), nrow=16) v2 <- matrix(rep(1:12, 16), nrow=16, byrow=TRUE) b <- brick(ncol=4, nrow=4) b1 <- setValues(b, v1) b2 <- setValues(b, v2) s <- stack(b1, b2) fun

Re: [R-sig-Geo] Raster error

2010-12-22 Thread Robert J. Hijmans
Hi Nick, Could you first update the raster package? It seems that you are using a relatively old version; perhaps this is something that has been fixed now. But who knows? List members, please supply the results of "sessionInfo()" whenever you report something that might be a bug. You should be a

[R-sig-Geo] Raster error

2010-12-22 Thread Nick Matzke
Hi all, I've been beginning to use the raster package and it looks great. But, any idea why I might be getting these errors? 1. library(raster) # Set working directory (you will need to change this) directory = "/Users/nick/Desktop/__projects/2010-09_Erin_Meyer_snails/_imgs/"

Re: [R-sig-Geo] gridded time series analysis

2010-12-22 Thread Advait Godbole
Dear Members, I was able to find a solution after some deliberation and posting it here for the benefit of forum members. To recap, my data was in the form of 2 netCDF files, each of dimension 356 x 507 x 120 (lat,lon,time). I wanted to perform regressions between the two variables on each grid p

Re: [R-sig-Geo] Converting array into raster brick

2010-12-22 Thread Robert J. Hijmans
Christian, You should also be able to do this: out <- setValues(x, xx) (where x is a RasterBrick and xx a matching 3 dimensional array) Robert On Wed, Dec 22, 2010 at 3:06 AM, Christian Kamenik wrote: > Dear all, > > I replaced my layer-by-layer approach > > for (l in 1:nlayers(x)) x > <-setV

[R-sig-Geo] matrix indexing in 'for' loop?

2010-12-22 Thread Elizabeth Crisfield
Maha, I'm no pro at this, but I think this will work for you... my additions or changes are bold italics, I struggled forever to do the same kind of thing and then winced when it turned out to be relatively simple. Hopefully someone else will chime in if this is a bad way to do it. ts.m.dmi <- ma

Re: [R-sig-Geo] export to .asc or .grd files

2010-12-22 Thread Carsten Neumann
Am 22.12.2010 18:01, schrieb Maxime Pauwels: > Hi Carsten, > > I think the Raster option is more appropriate to my skills. But it > doesn't work. > My script: > data=read.table("r_dataNssSF_continent.txt", header=T) > coordinates(data)=~long+lat > gridded(data)=TRUE > fullgrid(data)=TRUE > a1<-r

Re: [R-sig-Geo] export to .asc or .grd files

2010-12-22 Thread Carsten Neumann
Am 22.12.2010 15:34, schrieb Maxime Pauwels: > Hi Carsten, > > Thanks for your help. I never used rgdal before and therefore do not > understand what drivername is. > When I try your proposition, I ve got the following error message: > > Error in .local(.Object, ...) : > GDAL Error 6: GD

Re: [R-sig-Geo] Multiple legends in spplot

2010-12-22 Thread Lee Hachadoorian
On Wed, 22 Dec 2010 12:01:50 +0100, Edzer Pebesma wrote: > Lee, > > looking at sp:::SpatialPolygons2Grob, you can exactly see what this > function wants and does with it. As a (second) legend involves not only > polygons, but also points, symbols, and text, it will not do the job. Edzer, Thank

Re: [R-sig-Geo] Error in validityMethod(object) using SpatialGridDataFrame

2010-12-22 Thread Edzer Pebesma
On 12/22/2010 04:15 PM, Maxime Pauwels wrote: > Dear list, > > I try to create an object of class SpatialGridDataFrame-class and got > the following error I do not understand. > Error in validityMethod(object) : > unequal number of objects in full grid and data slot > > There is the script I

[R-sig-Geo] Error in validityMethod(object) using SpatialGridDataFrame

2010-12-22 Thread Maxime Pauwels
Dear list, I try to create an object of class SpatialGridDataFrame-class and got the following error I do not understand. Error in validityMethod(object) : unequal number of objects in full grid and data slot There is the script I use. Does anyone could help me understanding where I am wron

Re: [R-sig-Geo] export to .asc or .grd files

2010-12-22 Thread Maxime Pauwels
Hi Carsten, Thanks for your help. I never used rgdal before and therefore do not understand what drivername is. When I try your proposition, I ve got the following error message: Error in .local(.Object, ...) : GDAL Error 6: GDALDriver::Create() ... no create method implemented for th

Re: [R-sig-Geo] matrix indexing in 'for' loop?

2010-12-22 Thread Tom Gottfried
Hi Maha, note that factors in your example is a character vector. So y is too. And then you try to retrieve the values in your matrix from y... You could put your matrices in a list and then use list-indexing in your outer loop: ts.m.dmi <- matrix(c(1:20), 4, 5) ts.m.soi <- matrix(c(21:40), 4

Re: [R-sig-Geo] spatial clusters

2010-12-22 Thread Roger Bivand
On Wed, 22 Dec 2010, dorina.lazar wrote: Dear Roger, Thanks, your suggestions was helpful. I think I exaggerated the questions, but for all countries: “Error in mstree(le, 5): Graph is not connected!”; taking only some samples of countries the graph is connected. There is something to be done

Re: [R-sig-Geo] Converting array into raster brick

2010-12-22 Thread Christian Kamenik
Dear all, I replaced my layer-by-layer approach for (l in 1:nlayers(x)) x <-setValues(x,values=as.vector(t(xx[,,l])),layer=l) with the new functionality of brick out <- brick(xx,xmn=slot(extent(x),'xmin'),xmx=slot(extent(x),'xmax'),ymn=slot(extent(x),'ymin'),ymx=slot(extent(x),'ymax'),crs=pro

Re: [R-sig-Geo] Multiple legends in spplot

2010-12-22 Thread Edzer Pebesma
Lee, looking at sp:::SpatialPolygons2Grob, you can exactly see what this function wants and does with it. As a (second) legend involves not only polygons, but also points, symbols, and text, it will not do the job. An ad-hoc solution to this would be, building on your well-prepared example and th

Re: [R-sig-Geo] spatial clusters

2010-12-22 Thread dorina.lazar
Dear Roger, Thanks, your suggestions was helpful. I think I exaggerated the questions, but for all countries: “Error in mstree(le, 5): Graph is not connected!”; taking only some samples of countries the graph is connected. There is something to be done in this case? All the best, Dorina On

Re: [R-sig-Geo] RGDAL

2010-12-22 Thread Ralf Schäfer
Hi Daniel, You are missing a compiler for the source code. I reckon you have 2 simple options (of course there are more but these seem easiest for me): a) try to install the rgdal package from kyngchaos - that is compiled b) Install Xcode tools from Apple (is recommended anyway for many applic