Re: [R-sig-Geo] Getting vector index (i.e. layer number) for each cell in raster brick

2011-12-01 Thread Robert J. Hijmans
Hi Lyndon, I think there is a function for that: x <- stackSelect(rb2, ind.r) I.e., for each cell, use the value in ind.r to select the layer in rb2 from which to take the value for the output layer. Best, Robert On Thu, Dec 1, 2011 at 5:55 PM, Lyndon Estes wrote: > Dear List, > > I was ho

[R-sig-Geo] Getting vector index (i.e. layer number) for each cell in raster brick

2011-12-01 Thread Lyndon Estes
Dear List, I was hoping to get some advice on the best way to solve the following problem given two raster bricks. Given two bricks: r.list <- lapply(1:20, function(x) { r <- raster(xmn = 25, xmx = 32, ymn = -34, ymx = -27) res(r) <- 0.1 r[] <- runif(ncell(r)) return(r) }) rs1 <- stack(lappl

Re: [R-sig-Geo] spdep and server

2011-12-01 Thread Matilde Karakachoff
Ok ok, thanks to all! The "lazy" was me! The server admin updated R and packages two days ago, but not me! R version on my Windows C is R version 2.13.1 (2011-07-08) and sp version Package: sp Version: 0.9-88 Date: 2011-09-14 I haven't access to server now, but I took note and I will run i

Re: [R-sig-Geo] spdep and server

2011-12-01 Thread Roger Bivand
On Thu, 1 Dec 2011, jon.sko...@jrc.ec.europa.eu wrote: On 01-Dec-11 17:28, Barry Rowlingson wrote: Its nothing to do with spdep because this is only using the sp package and not spdep. This is what we call a reproducible example: library(sp) d=data.frame(x=rep(1:4,4),y=rep(1:4,rep(4,4)),z

Re: [R-sig-Geo] KED predictions using raster package

2011-12-01 Thread Robert J. Hijmans
David, Can you provide a reproducible example, perhaps based on the below (from ?interpolate), but then mimicking what you are doing? Robert library(gstat) library(raster) r <- raster(system.file("external/test.grd", package="raster")) data(meuse) mg <- gstat(id = "zinc", formula = zinc~1, locatio

Re: [R-sig-Geo] spdep and server

2011-12-01 Thread jon . skoien
On 01-Dec-11 17:28, Barry Rowlingson wrote: Its nothing to do with spdep because this is only using the sp package and not spdep. This is what we call a reproducible example: library(sp) d=data.frame(x=rep(1:4,4),y=rep(1:4,rep(4,4)),z=runif(16)) coordinates(d)=~x+y d.sp=as(d,"SpatialPix

Re: [R-sig-Geo] spdep and server

2011-12-01 Thread jon . skoien
Hi Matilde, see inline comments below. On 01-Dec-11 15:45, Matilde Karakachoff wrote: Ok, I’m sorry. I think that there was a little problem with my previous message. I’m trying to execute some R commands on a linux server (where I installed R and packages previously) to create a SpatialGridD

Re: [R-sig-Geo] spdep and server

2011-12-01 Thread Barry Rowlingson
>> Locus1.gr <- as(Locus1.sp, 'SpatialGridDataFrame') > > The first four lines are ok, but the last one gives the following error: > > Error in asMethod(object, Class, value) : replace-coercion not allowed > > But if I run it on my computer it works. So, why it doesn’t work on a > server? May be th

Re: [R-sig-Geo] spdep and server

2011-12-01 Thread Sarah Goslee
A reproducible example and the basis system information requested in the posting guide would be very helpful. OS, version of R, versions of the relevant packages... We really do need this information to answer questions. Sarah On Thu, Dec 1, 2011 at 9:45 AM, Matilde Karakachoff wrote: > Ok, I’m

Re: [R-sig-Geo] spdep and server

2011-12-01 Thread Matilde Karakachoff
Ok, I’m sorry. I think that there was a little problem with my previous message. I’m trying to execute some R commands on a linux server (where I installed R and packages previously) to create a SpatialGridDataFrame. It has to be a grid 10*10 to which I will associate data resulting from simu

Re: [R-sig-Geo] spdep and server

2011-12-01 Thread Matilde Karakachoff
Ok, I'm sorry. I think that there was a little problem with my previous message. I'm trying to execute some R commands on a linux server (where I installed R and packages previously) to create a SpatialGridDataFrame. It has to be a grid 10*10 to which I will associate data resulting from simu

Re: [R-sig-Geo] spdep and server

2011-12-01 Thread Paul Hiemstra
Hi Matilde, Your short and cryptic mail leaves us guessing what is going wrong here. Please provide more info, see the R-help posting guide for some advice [1]. Most important is a small piece of R code which reproduces this problem. regards, Paul [1] http://www.r-project.org/posting-guide.html

[R-sig-Geo] KED predictions using raster package

2011-12-01 Thread David Stephens (Cefas)
Hi, Im trying to apply a gstat model that incorporates an external drift variable to a raster, using the interpolate function of the raster package. I seem to be having trouble making it use the values of the raster layer as the covariate specified in the gstat formula. Any help greatly appreciate

[R-sig-Geo] spdep and server

2011-12-01 Thread Matilde Karakachoff
Hello all, I'm trying to execute a very simple command on a linux server: Locus1grid as asMethod -> as asMethod Execution halted Could you help me? May be the sspdep package doesn't work in the same way if working on a server? I admit that my experience working with servers is almost 0!!