Re: [R-sig-Geo] Combining polygons and calculating their area (i.e. number of cells)

2013-12-20 Thread Roger Bivand
On Thu, 19 Dec 2013, Josh O'Brien wrote: On Thu, Dec 19, 2013 at 4:23 AM, Roger Bivand roger.biv...@nhh.no wrote: On Wed, 18 Dec 2013, Josh O'Brien wrote: ...snip... By the way, always avoid accessing S4 objects directly using @, do use slot(obj, slotname) - the sapply should read: area

Re: [R-sig-Geo] Combining polygons and calculating their area (i.e. number of cells)

2013-12-20 Thread Josh O'Brien
On Fri, Dec 20, 2013 at 5:38 AM, Roger Bivand roger.biv...@nhh.no wrote: On Thu, 19 Dec 2013, Josh O'Brien wrote: On Thu, Dec 19, 2013 at 4:23 AM, Roger Bivand roger.biv...@nhh.no wrote: On Wed, 18 Dec 2013, Josh O'Brien wrote: ...snip... By the way, always avoid accessing S4 objects

Re: [R-sig-Geo] Combining polygons and calculating their area (i.e. number of cells)

2013-12-20 Thread Edzer Pebesma
On 12/20/2013 06:20 PM, Josh O'Brien wrote: On Fri, Dec 20, 2013 at 5:38 AM, Roger Bivand roger.biv...@nhh.no wrote: On Thu, 19 Dec 2013, Josh O'Brien wrote: On Thu, Dec 19, 2013 at 4:23 AM, Roger Bivand roger.biv...@nhh.no wrote: On Wed, 18 Dec 2013, Josh O'Brien wrote: ...snip...

Re: [R-sig-Geo] Combining polygons and calculating their area (i.e. number of cells)

2013-12-20 Thread Roger Bivand
On Fri, 20 Dec 2013, Josh O'Brien wrote: On Fri, Dec 20, 2013 at 5:38 AM, Roger Bivand roger.biv...@nhh.no wrote: On Thu, 19 Dec 2013, Josh O'Brien wrote: On Thu, Dec 19, 2013 at 4:23 AM, Roger Bivand roger.biv...@nhh.no wrote: On Wed, 18 Dec 2013, Josh O'Brien wrote: ...snip... By

Re: [R-sig-Geo] Combining polygons and calculating their area (i.e. number of cells)

2013-12-19 Thread Roger Bivand
On Wed, 18 Dec 2013, Josh O'Brien wrote: This is cross-posted from StackOverflow (http://stackoverflow.com/questions/20659186/combining-polygons-and-calculating-their-area-i-e-number-of-cells-in-r), where it has received an answer that I believe answers both questions. Because of the forking

Re: [R-sig-Geo] Combining polygons and calculating their area (i.e. number of cells)

2013-12-19 Thread Josh O'Brien
On Thu, Dec 19, 2013 at 4:23 AM, Roger Bivand roger.biv...@nhh.no wrote: On Wed, 18 Dec 2013, Josh O'Brien wrote: ...snip... By the way, always avoid accessing S4 objects directly using @, do use slot(obj, slotname) - the sapply should read: area = sapply(slot(SPclus, polygons), slot,

[R-sig-Geo] Combining polygons and calculating their area (i.e. number of cells)

2013-12-18 Thread Alexander Zimmermann
Dear All, I have a problem with combining polygons and calculating their area. In the following I try to provide a description of the problem: I have a simple raster (created with R-package: raster). Using the function rasterToPolygons I get polygons of all raster cells that contain the value

Re: [R-sig-Geo] Combining polygons and calculating their area (i.e. number of cells)

2013-12-18 Thread Robert J. Hijmans
Alex, Do you need to create polygons? You can do things like: m - clump(r) freq(m) But if you insist on polygons: m - clump(r) p - rasterToPolygons(m, dissolve=TRUE) Robert On Wed, Dec 18, 2013 at 7:08 AM, Alexander Zimmermann alexander.zimmermann...@uni-potsdam.de wrote: Dear All, I have

Re: [R-sig-Geo] Combining polygons and calculating their area (i.e. number of cells)

2013-12-18 Thread Josh O'Brien
This is cross-posted from StackOverflow (http://stackoverflow.com/questions/20659186/combining-polygons-and-calculating-their-area-i-e-number-of-cells-in-r), where it has received an answer that I believe answers both questions. -- View this message in context: