Re: [R-sig-Geo] Bioclimatic variables - wettest quarter

2010-11-09 Thread Jacob van Etten
Hi Brian, My guess is that it goes wrong when this happens: which.max(c(NA,NA)) Try something like this instead: func - function (x) {   if(all(is.na(x))) {result - 0   } else {result - which.max(x)}   return(result) } Best, Jacob. --- On Tue, 9/11/10, Brian Oney zenli...@gmail.com wrote:

[R-sig-Geo] spatial point pattern with correlation structure

2010-11-09 Thread Patrick Giraudoux
Dear all, I was wondering if there is an easy way to generate coordinates of clustered spatial point pattern.(possibly with variations on the degree of aggregation). So far one can easily generate random patterns (splancs: csr; sp: spsample) or regular (sp: spsample or some simple lines of

Re: [R-sig-Geo] multiple regression analysis

2010-11-09 Thread Peter Kirchner
Hi Matevž, If I understand you correctly and your goal is to conduct a spatial analysis of the variables of parent material, and particle size e.g. clay, based on depth you will first need to make some decisions on how to classify your data based on depth. Then you could create a 2d raster

[R-sig-Geo] stack() and lapply

2010-11-09 Thread Roman Luštrik
Dear Listers, I have a list (list.of.files) of file names (character vector) with n number of elements. List of 9 $ 1: chr [1:5] binned_walker1_1.grd ... $ 2: chr [1:2] binned_walker2_1.grd ... $ 3: chr [1:3] binned_walker3_1.grd ... $ 4: chr [1:6] binned_walker4_1.grd ... $ 5: chr

Re: [R-sig-Geo] multiple regression analysis

2010-11-09 Thread Dylan Beaudette
Hi, Or, you could include additional variables into the model structure that describe vertical patterns. If you choose to do this, then it would also be wise to account for correlation between observations with depth and in space. Assuming that you can describe your response variable with some

Re: [R-sig-Geo] prob with legend in my plots!

2010-11-09 Thread govindas
thank you for your suggestion! -- Regards, Mahalakshmi Graduate Student #20, Department of Geography Michigan State University East Lansing, MI 48824 Quoting Ben Madin li...@remoteinformation.com.au: Maha, On 08/11/2010, at 5:20 PM, govin...@msu.edu wrote: Thanks for the info. I got my

[R-sig-Geo] How to neighbours list functions match coords?

2010-11-09 Thread Lee Hachadoorian
The example from the documentation for nbdists() uses two predefined objects (columbus and col.gal.nb), so it's not clear to me how coordinates are being matched (see below) library(spdep) example(columbus) coords - coordinates(columbus) dlist - nbdists(col.gal.nb, coords) Does nbdists() match

Re: [R-sig-Geo] How to neighbours list functions match coords?

2010-11-09 Thread Roger Bivand
On Tue, 9 Nov 2010, Lee Hachadoorian wrote: The example from the documentation for nbdists() uses two predefined objects (columbus and col.gal.nb), so it's not clear to me how coordinates are being matched (see below) library(spdep) example(columbus) coords - coordinates(columbus) dlist -

Re: [R-sig-Geo] Bioclimatic variables - wettest quarter

2010-11-09 Thread Brian Oney
Thanks! it worked great. Much appreciated. Brian On 11/8/2010 5:44 PM, Jacob van Etten wrote: Oops, the function should of course be something like this: func - function(x) { from - c(12,1:11)[x[13]] to - c(2:12,1)[x[13]] return(sum(x[c(from,x[13],to)])) } --- On *Mon,

Re: [R-sig-Geo] spatial point pattern with correlation structure

2010-11-09 Thread Rolf Turner
On 10/11/2010, at 7:21 AM, Roger Bivand wrote: On Tue, 9 Nov 2010, Patrick Giraudoux wrote: Dear all, I was wondering if there is an easy way to generate coordinates of clustered spatial point pattern.(possibly with variations on the degree of aggregation). So far one can easily

Re: [R-sig-Geo] How to neighbours list functions match coords?

2010-11-09 Thread Lee Hachadoorian
On 11/09/2010 02:12 PM, Roger Bivand wrote: On Tue, 9 Nov 2010, Lee Hachadoorian wrote: The example from the documentation for nbdists() uses two predefined objects (columbus and col.gal.nb), so it's not clear to me how coordinates are being matched (see below) Good question. None of these

Re: [R-sig-Geo] How to neighbours list functions match coords?

2010-11-09 Thread Edzer Pebesma
On 11/09/2010 09:05 PM, Lee Hachadoorian wrote: On 11/09/2010 02:12 PM, Roger Bivand wrote: On Tue, 9 Nov 2010, Lee Hachadoorian wrote: The example from the documentation for nbdists() uses two predefined objects (columbus and col.gal.nb), so it's not clear to me how coordinates are

Re: [R-sig-Geo] How to neighbours list functions match coords?

2010-11-09 Thread Lee Hachadoorian
On Tue, 09 Nov 2010 21:19:45 +0100, Edzer Pebesma wrote: On 11/09/2010 09:05 PM, Lee Hachadoorian wrote: row.names(spdf) = as.character(spdf$key_field) sp = as(spdf, SpatialPolygons) row.names(df) = df$key_field spdfNew = SpatialPolygonsDataFrame(sp, df, match.ID = TRUE) It would be

Re: [R-sig-Geo] How to neighbours list functions match coords?

2010-11-09 Thread Edzer Pebesma
On 11/09/2010 10:03 PM, Lee Hachadoorian wrote: On Tue, 09 Nov 2010 21:19:45 +0100, Edzer Pebesma wrote: On 11/09/2010 09:05 PM, Lee Hachadoorian wrote: row.names(spdf) = as.character(spdf$key_field) sp = as(spdf, SpatialPolygons) row.names(df) = df$key_field spdfNew =

Re: [R-sig-Geo] write NA with writeRaster

2010-11-09 Thread Robert J. Hijmans
Bastien, The way it currently works with Byte type files is that all values below zero become zero, and all values = 255 become NA. That, is 255 is the missing value flag What is clearly wrong, is that NA (and NaN) become zero, rather than NA. I can solve this in raster, but it seems that is

Re: [R-sig-Geo] How to neighbours list functions match coords?

2010-11-09 Thread Lee Hachadoorian
On Tue, 09 Nov 2010 22:12:25 +0100, Edzer Pebesma wrote: You're right of course, sorry for the misunderstanding, I meant to say to modify sp such that ... works My bad, sorry for replying with the obvious. --Lee -- Lee Hachadoorian PhD Student, Geography Program in Earth Environmental

Re: [R-sig-Geo] Bioclimatic variables - wettest quarter

2010-11-09 Thread Robert J. Hijmans
Hi Brian, This: avg - overlay(mon_stac, fun=maxmonth) does not work because overlay requires multiple (at least 2) Raster objects. In your case RasterLayer objects avg - overlay(a, b, c, etc... , fun=maxmonth) An alternative would be to use the list of RasterLayers in the RasterStack and