I've tried your method to determine the richness of landscapes on my area of
interest using european corine land cover.

I converted my polygon layer into a SpatialGridDataFrame then into a
SpatialPointsDataFrame, and finally into a ppp object using one column: the
type of soil occupation (CLC3_LIB).

But my problem is that marktable gives me zero values, although I should get
at least a "1" value for one of my columns...

Here is a sample code:
> ppp[1:5]$marks
[1] Mer et océan
[2] Végétation clairsemée
[3] Pelouses et pâturages naturels
[4] Végétation sclérophylle (y.c. maquis et garrigue)
[5] Végétation sclérophylle (y.c. maquis et garrigue)

> marktable(ppp[1:10], R=50)
     mark
point Aéroports Chantiers Cours et voie d'eau
   1          0         0                   0
   2          0         0                   0
   3          0         0                   0
   4          0         0                   0
   5          0         0                   0
   6          0         0                   0
   7          0         0                   0
   8          0         0                   0
   9          0         0                   0
   10         0         0                   0
     mark
point Equipements sportifs et de loisirs
   1                                   0
   2                                   0
   3                                   0
   4                                   0
   5                                   0
   6                                   0
   7                                   0
   8                                   0
   9                                   0
   10                                  0

I don't see where the problem is..

Any help would be greatly appreciated.

Mathieu

2011/5/17 Marcelino de la Cruz <marcelino.delacruz@upm.es>

> On 16/05/2011 10:27, Matevž Pavlič wrote:
>
>> Hi all,
>>
>> I read (just now) about the Simpson idex. This would probably be a good
>> thing to try in my case. Do you have any ideas of how to create a diversity
>> map using Simpson index?
>>
>>
> library(vegan)
> simpson <- diversity(lansing.tab, "simpson")
> lansing.simpson <-  setmarks(lansing,simpson)
> lansing.simpson.s <-smooth.ppp(lansing.simpson)
> plot(lansing.simpson.s)
>
>
>  . I have just a few more questions about the code :
>>
>> The line below as I understand sets a table for each point with the type
>> of points that are in the near in the radius R=350 units?
>> mol.tab<- marktable(mol.ppp,R=350)
>>
>>
>
> Yes.
> To resolve questions like this about the arguments of the functions, please
> read the help pages, e.g.
> help(marktable)
>
>
>  And this line creates a surface(map) of diversity ?
>> lansing.div.s<-smooth.ppp(lansing.div)
>>
> Yes again.
> help(smooth.ppp); help(density.ppp)
>
>
>>
>> I think this map that is created with smooth.ppp is to rough giving to
>> little detail on the diversity. Would it be possible to use kriging to
>> create diversity map?
>>
>>
> It depends on what do you think is "too rough". You may control
> the"roughnes" of the map changing the "dimyx" argument (that controls the
> final grid of the smoothed surface). You may be also interested in setting
> the argument "sigma" (that controls the bandwith of the smoothing kernel).
> Although it is possible to krige the results, I think that in this case is
> preferable to trust the smoothed surface.
>
> Cheers,
> Marcelino
>
>
>
>
>  Thanks for the help,
>>
>> m
>>
>> -----Original Message-----
>> From: marcelino.delacruz@upm.es [mailto:marcelino.delacruz@upm.es]
>> Sent: Monday, May 16, 2011 9:59 AM
>> To: Matevž Pavlič
>> Cc: r-sig-geo@r-project.org
>> Subject: RE: [R-sig-Geo] density /diversity of points
>>
>> Con fecha 15/5/2011, "Matevž Pavli&#269;"<matevz.pavlic@gi-zrmk.si>
>> escribió:
>>
>>
>>
>>> Hi Marcelino,
>>>
>>> Was out of the office for a while...
>>> Thanks for the help. I think this could work...but can you tell me what
>>> this line does?
>>>
>>> diversity<- apply(mol.tab,1,function(x) sum(x>0))
>>>
>>>
>>
>> mol.tab is a table with the number of occurrences of each type (columns)
>> in the neighborhood of each point (rows). This line computes for each
>> row (i.e. for each point) the number of types whose value is ">0"
>> (i.e. types that are present in the neighborhood). This is a very simple
>> definition of diversity (i.e. "richness"). From that table you could
>> also compute Shannon or Simpson diversity indices, if you would prefer
>> that.
>>
>>
>> Marcelino
>>
>>
>>
>>> i cant figure out how diversity is calculated here?
>>>
>>> Thanks again for the help,
>>>
>>> matevz
>>>
>>> -----Original Message-----
>>> From: Marcelino de la Cruz [mailto:marcelino.delacruz@upm.es]
>>> Sent: Thursday, May 12, 2011 2:03 PM
>>> To: MatevÅ¾ PavliÄ Cc: r-sig-geo@r-project.org
>>> Subject: Re: [R-sig-Geo] density /diversity of points
>>>
>>> On 12/05/2011 13:12, MatevÅ¾ PavliÄ  wrote:
>>>
>>>
>>>> Hi all,
>>>>
>>>>
>>>>
>>>> I have a point data set (SHP) with coordinates and a attribute (i.e.
>>>> type of point).
>>>>
>>>> These points are scattered around a fairly big area. What i would like
>>>> to do is to find a sub-area where density of points sombined with the
>>>> diversity of type is the biggest.
>>>>
>>>> Does anyone have any idea iff this is somehowe possible to do in R?
>>>> Any idea would be greatly aprpeciated,
>>>>
>>>>
>>>>
>>>>
>>> To your first question:
>>>
>>> library(fortunes)
>>> fortune("Yoda")
>>>
>>> ;-)
>>>
>>> More seriously, you could  transform your shp data in a ppp object with
>>> spatstat. See the vignette in spatstat. Then you can use some functions
>>> there, for example (with the data set lansing):
>>>
>>> library(spatstat)
>>> data(lansing)
>>> plot(lansing)
>>> # get an estimate of point density
>>> lansing.den<- density.ppp(lansing)
>>> plot(lansing.den)
>>>
>>> # get an estimate of point diversity (here, for the shake of brevity, at
>>> the points themselves)
>>> lansing.tab<- marktable(lansing,R=0.05)
>>> diversity<- apply(lansing.tab,1,function(x) sum(x>0)) lansing.div<-
>>> setmarks(lansing,diversity) lansing.div.s<-smooth.ppp(lansing.div)
>>>
>>> plot(lansing.div.s)
>>>
>>> # select areas with arbitrary high values of  density and diversity plot(
>>> eval.im(lansing.div.s>4.5&  (lansing.den/max(lansing.den))>0.9))
>>>
>>>
>>> HTH. Cheers,
>>>
>>> Marcelino
>>>
>>>
>>>
>>> --
>>> _________________________________
>>>
>>> Marcelino de la Cruz Rot
>>> Departamento de Biologia Vegetal
>>> E.U.T.I. Agricola
>>> Universidad Politecnica de Madrid
>>>  28040 Madrid
>>>  Tel: 34913365654
>>>  _________________________________
>>>
>>>
>>>
>>
>
> --
> _________________________________ Marcelino de la Cruz Rot Departamento de
> Biologia Vegetal E.U.T.I. Agricola Universidad Politecnica de Madrid 28040
> Madrid Tel: 34913365654 _________________________________
>
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

