<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Muito obrigado Éder!!<br>
<br>
<br>
Essa sua solução é ótima quando tenho SpatialPoints(),
que é o meu caso, fiz com planar points do spatstat apenas para
montar o CMR.<br>
<br>
<br>
Valeu pela solução alternativa!!<br>
<br>
<pre class="moz-signature" cols="72">--
======================================================================
Alexandre dos Santos
Proteção Florestal
IFMT - Instituto Federal de Educação, Ciência e Tecnologia de Mato Grosso
Campus Cáceres
Caixa Postal 244
Avenida dos Ramires, s/n
Bairro: Distrito Industrial
Cáceres - MT CEP: 78.200-000
Fone: (+55) 65 8132-8112 (TIM) (+55) 65 9686-6970 (VIVO)
<a class="moz-txt-link-abbreviated" href="mailto:e-mails:alexandresantosbr@yahoo.com.br">e-mails:alexandresantosbr@yahoo.com.br</a>
<a class="moz-txt-link-abbreviated" href="mailto:alexandre.santos@cas.ifmt.edu.br">alexandre.santos@cas.ifmt.edu.br</a>
Lattes: <a class="moz-txt-link-freetext" href="http://lattes.cnpq.br/1360403201088680">http://lattes.cnpq.br/1360403201088680</a>
OrcID: orcid.org/0000-0001-8232-6722
Researchgate: <a class="moz-txt-link-freetext" href="https://www.researchgate.net/profile/Alexandre_Santos10">https://www.researchgate.net/profile/Alexandre_Santos10</a>
LinkedIn: <a class="moz-txt-link-freetext" href="https://br.linkedin.com/in/alexandre-dos-santos-87961635">https://br.linkedin.com/in/alexandre-dos-santos-87961635</a>
======================================================================
</pre>
<div class="moz-cite-prefix">Em 14/01/2016 16:37, Éder Comunello
escreveu:<br>
</div>
<blockquote
cite="mid:CABmC8g=ite_LsA9u5CxBPJFefq0Uj8nqK8tEPvug7JZE_av6sQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_default"
style="font-family:verdana,sans-serif">Olá, boa tarde!</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif"><br>
</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif">Alexandre, não sei se
entendi bem sua necessidade, mas deixo uma sugestão baseado no
que você e o Elias já fizeram...</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif"><br>
</div>
<div class="gmail_default" style="">
<div class="gmail_default"><font face="monospace, monospace">#Pacotes</font></div>
<div class="gmail_default"><font face="monospace, monospace">require(shapefiles)</font></div>
<div class="gmail_default"><font face="monospace, monospace">require(rgdal)</font></div>
<div class="gmail_default"><font face="monospace, monospace">require(maptools)</font></div>
<div class="gmail_default"><font face="monospace, monospace">require(spatstat)</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">#-------------------------------------------------------------------------------</font></div>
<div class="gmail_default"><font face="monospace, monospace">#Criação
de 4 polígonos</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">sr
<- SpatialPolygons(list(</font></div>
<div class="gmail_default"><font face="monospace, monospace">Polygons(list(Polygon(cbind(c(180114,
180553, 181127, 181477, 181294, 181007, 180409,</font></div>
<div class="gmail_default"><font face="monospace, monospace">
180162, 180114), c(332349, 332057, 332342, 333250, 333558,
333676,</font></div>
<div class="gmail_default"><font face="monospace, monospace">
332618, 332413, 332349)))),'1'),</font></div>
<div class="gmail_default"><font face="monospace, monospace">Polygons(list(Polygon(cbind(c(180042,
180545, 180553, 180314, 179955, 179142, 179437,</font></div>
<div class="gmail_default"><font face="monospace, monospace">
179524, 179979, 180042), c(332373, 332026, 331426, 330889,
330683,</font></div>
<div class="gmail_default"><font face="monospace, monospace">
331133, 331623, 332152, 332357, 332373)))),'2'),</font></div>
<div class="gmail_default"><font face="monospace, monospace">Polygons(list(Polygon(cbind(c(179110,
179907, 180433, 180712, 180752, 180329, 179875,</font></div>
<div class="gmail_default"><font face="monospace, monospace">
179668, 179572, 179269, 178879, 178600, 178544, 179046,
179110),</font></div>
<div class="gmail_default"><font face="monospace, monospace">
c(331086, 330620, 330494, 330265, 330075, 330233, 330336,
330004,</font></div>
<div class="gmail_default"><font face="monospace, monospace">
329783, 329665, 329720, 329933, 330478, 331062,
331086)))),'3'),</font></div>
<div class="gmail_default"><font face="monospace, monospace">Polygons(list(Polygon(cbind(c(180304,
180403,179632,179420,180304),</font></div>
<div class="gmail_default"><font face="monospace, monospace">
c(332791, 333204, 333635, 333058, 332791)))),'4')))</font></div>
<div class="gmail_default"><font face="monospace, monospace">plot(sr)</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">#Converte
em polígonos espaciais</font></div>
<div class="gmail_default"><font face="monospace, monospace">srdf=SpatialPolygonsDataFrame(sr,
data.frame(row.names=c('1','2','3','4'), PIDS=1:4))</font></div>
<div class="gmail_default"><font face="monospace, monospace">srdf@data</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">#Seleção
de pontos</font></div>
<div class="gmail_default"><font face="monospace, monospace">set.seed(222)</font></div>
<div class="gmail_default"><font face="monospace, monospace">pts
<- rpoispp(lambda=0.000012, win=srdf)</font></div>
<div class="gmail_default"><font face="monospace, monospace">pts2
<- SpatialPoints(data.frame(pts$x, pts$y),
proj4string=CRS(as.character(NA)))</font></div>
<div class="gmail_default"><font face="monospace, monospace">points(pts2)</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">#Classificação
dos pontos em cada área</font></div>
<div class="gmail_default"><font face="monospace, monospace">pts$PIDS
<- over(pts2, srdf)$PIDS</font></div>
<div class="gmail_default"><font face="monospace, monospace">pontos
<- data.frame(x=pts$x, y=pts$y, PID=pts$PIDS)</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">head(pontos)</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
x y PID</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
1 179576.1 330096.8 3</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
2 180224.7 332009.1 2</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
3 178968.3 330136.9 3</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
4 180495.7 332731.4 1</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
5 178880.9 329897.9 3</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
6 181047.9 333129.5 1</font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">table(pontos$PID)</font></div>
<div class="gmail_default"><font face="monospace, monospace">#
1 2 3 4 </font></div>
<div class="gmail_default"><font face="monospace, monospace">#
17 18 16 6 </font></div>
<div class="gmail_default"><font face="monospace, monospace"><br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">plot(sr);
points(pontos, col=pontos$PID)<br>
</font></div>
<div class="gmail_default"><font face="monospace, monospace">#-------------------------------------------------------------------------------</font></div>
<div style="font-family:verdana,sans-serif"><br>
</div>
</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif"><br>
</div>
<div class="gmail_default"
style="font-family:verdana,sans-serif"><br>
</div>
<div class="gmail_extra"><br clear="all">
<div>
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr"><font style="font-size:small"
face="arial, helvetica, sans-serif">
<div style="font-family:'trebuchet
ms',sans-serif;display:inline"></div>
================================================<br>
Éder Comunello</font>
<div style="font-size:small"><span
style="font-family:arial,helvetica,sans-serif">PhD
Student in Agricultural Systems
Engineering (USP/Esalq)</span><br>
</div>
<div><span style="font-size:small">Brazilian
Agricultural Research Corporation (</span><font
style="font-size:small" face="arial,
helvetica, sans-serif">Embrapa)</font>
<div style="font-size:small"><font
face="arial, helvetica, sans-serif">Dourados,
MS, Brazil [</font>22 16.5'S, 54 49.0'W<span
style="font-family:arial,helvetica,sans-serif">]</span></div>
<div>
<div><br>
</div>
<div><br>
</div>
</div>
<div style="font-size:small"><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<div class="gmail_quote">2016-01-14 13:27 GMT-03:00 Elias
Teixeira Krainski <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:eliaskrainski@yahoo.com.br" target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:eliaskrainski@yahoo.com.br">eliaskrainski@yahoo.com.br</a></a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">conte
o numero de pontos em cada area, basta usar nrow() em cada
elemento, e crie um indice com rep()
<div class="">
<div class="h5"><br>
_______________________________________________<br>
R-br mailing list<br>
<a moz-do-not-send="true"
href="mailto:R-br@listas.c3sl.ufpr.br"
target="_blank">R-br@listas.c3sl.ufpr.br</a><br>
<a moz-do-not-send="true"
href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br"
rel="noreferrer" target="_blank">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a><br>
Leia o guia de postagem (<a moz-do-not-send="true"
href="http://www.leg.ufpr.br/r-br-guia"
rel="noreferrer" target="_blank">http://www.leg.ufpr.br/r-br-guia</a>)
e fornea cdigo mnimo reproduzvel.</div>
</div>
</blockquote>
</div>
<br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
R-br mailing list
<a class="moz-txt-link-abbreviated" href="mailto:R-br@listas.c3sl.ufpr.br">R-br@listas.c3sl.ufpr.br</a>
<a class="moz-txt-link-freetext" href="https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br">https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br</a>
Leia o guia de postagem (<a class="moz-txt-link-freetext" href="http://www.leg.ufpr.br/r-br-guia">http://www.leg.ufpr.br/r-br-guia</a>) e forne�a c�digo m�nimo reproduz�vel.</pre>
</blockquote>
<br>
</body>
</html>