[R-br] RES: Seleção de um vetor em um list

Oswaldo G. Cruz ogcruz em gmail.com
Segunda Dezembro 23 21:52:52 BRST 2013


Não ficou claro o que vc quer, são os pontos rejeitados? Se for vc pode acessa-los assim!



attributes(syn.ppp)$rejects$x



[]´s

Oswaldo



De: R-br [mailto:r-br-bounces em listas.c3sl.ufpr.br] Em nome de ASANTOS
Enviada em: segunda-feira, 23 de dezembro de 2013 21:09
Para: r-br em listas.c3sl.ufpr.br
Assunto: Re: [R-br] Seleção de um vetor em um list

Obrigado Benilton, mas não funcionou, segue CRM abaixo:

require(spatstat)

# Two polygons coordinates------------------------------------------------------

#Polygon 1
x.coords1<-c(371299.9,    371266.4,    371205.6,    371111.8, 371047.6,    371018.2,    371014.0,
              371009.3,    370983.1,    370919.7,    370853.6, 370785.6,    370748.8,    370711.8,
              370687.8,    370696.4,    370785.9,    370885.5, 371035.8,    371148.1,    371205.2,
              371231.7,    371236.5,    371240.3,    371285.8, 371326.5,    371397.2,    371417.1,
              371432.9,    371445.0,    371455.7,    371466.4, 371476.6,    371502.6,    371536.0,
              371550.0,    371546.8,    371528.3,    371470.0, 371393.3,    371299.9,    371299.9)

y.coords1<-c(8246589,    8246560,    8246508,    8246428, 8246373,    8246349,    8246348,
             8246352,    8246385,    8246465,    8246551, 8246638,    8246685,    8246732,
             8246764,    8246771,    8246846,    8246932, 8247062,    8247160,    8247209,
             8247230,    8247224,    8247221,    8247160, 8247107,    8247016,    8246991,
             8246967,    8246939,    8246914,    8246892, 8246875,    8246846,    8246821,
             8246809,    8246802,    8246785,    8246735, 8246669,    8246589,    8246589)

#Polygon 2

x.coords2<-c(368382.9,    368399.4,    368394.1,    368464.7, 368652.2,    368683.7,    368699.7,
             368714.9,    368714.9,    368714.9,    368860.9, 368932.1,    368994.8,    368994.8,
             369015.7,    369014.5,    369014.5,    369026.8, 369045.2,    369020.0,    368952.9,
             368951.4,    368952.9,    368951.4,    368936.8, 368923.4,    368804.1,    368676.0,
             368178.1,    368182.4,    368202.2,    368216.2, 368233.4,    368251.3,    368270.3,
             368281.7,    368300.6,    368323.8,    368344.8, 368364.6,    368374.2,    368382.9)



y.coords2<-c(8249120,    8249150,    8249153,    8249244, 8249173,    8249167,    8249154,
                8249145,    8249145,    8249145,    8249048, 8249026,    8249003,    8249003,
             8248993,    8248991,    8248991,    8248984, 8248970,    8248889,    8248833,
             8248829,    8248833,    8248829,    8248790, 8248765,    8248626,    8248526,
             8248774,    8248780,    8248815,    8248843, 8248871,    8248903,    8248934,
             8248952,    8248978,    8249013,    8249049, 8249086,    8249103,    8249120)
            
# Window creation

D1 <- unique(data.frame(x=rev(x.coords1),y=rev(y.coords1)))
W1 <- owin(poly=D1)
D2 <- unique(data.frame(x=rev(x.coords2),y=rev(y.coords2)))
W2 <- owin(poly=D2)
W   <- union.owin(W1,W2)
plot(W)


# Create point process
xypois=rpoispp(0.0001, win=owin(c(min(W$xrange),max(W$xrange)),c(min(W$yrange),max(W$yrange))))
points(xypois$x,xypois$y, col="red")
#
syn.ppp<-ppp(x=xypois$x,y=xypois$y,window=W)
plot(syn.ppp, main=" ")
# END

str(syn.ppp)

Em 23/12/2013 18:08, Benilton Carvalho escreveu:
usando seu exemplo nao-reprodutivel, eu chutaria algo como: 

syn.ppp$markformat$x

b

Em 23 de dezembro de 2013 16:54, ASANTOS <alexandresantosbr em yahoo.com.br> escreveu:
Boa tarde pessoal,

     Estou quebrando a cabeça com um list criado com o pacote spatstat, gostaria de selecionar o
vetor $ x : num [1:906] dentro do - attr(*, "class")= chr "owin" no objeto syn.ppp abaixo, porém fiz
str() e names() em vários níveis, como syn.ppp$window$units e vários outros e não consegui achar
este vetor, alguém poderia me dar um help?

Obrigado

> str(syn.ppp)
List of 5
 $ window    :List of 11
  ..$ type    : chr "mask"
  ..$ xrange  : num [1:2] 368178 371550
  ..$ yrange  : num [1:2] 8246348 8249244
  ..$ dim     : int [1:2] 128 128
  ..$ xstep   : num 26.3
  ..$ ystep   : num 22.6
  ..$ warnings: chr [1:3] "Row index corresponds to increasing y coordinate; column to increasing x"
"Transpose matrices to get the standard presentation in R" "Example:
image(result$xcol,result$yrow,t(result$d))"
  ..$ xcol    : num [1:128] 368191 368218 368244 368270 368297 ...
  ..$ yrow    : num [1:128] 8246359 8246382 8246405 8246427 8246450 ...
  ..$ m       : logi [1:128, 1:128] FALSE FALSE FALSE FALSE FALSE FALSE ...
  ..$ units   :List of 3
  .. ..$ singular  : chr "unit"
  .. ..$ plural    : chr "units"
  .. ..$ multiplier: num 1
  .. ..- attr(*, "class")= chr "units"
  ..- attr(*, "class")= chr "owin"
 $ n         : int 74
 $ x         : num [1:74] 368987 371068 368638 368800 368424 ...
 $ y         : num [1:74] 8248993 8246965 8248866 8249077 8248739 ...
 $ markformat: chr "none"
 - attr(*, "class")= chr "ppp"
 - attr(*, "rejects")=List of 5
  ..$ window    :List of 5
  .. ..$ type  : chr "polygonal"
  .. ..$ xrange: num [1:2] 368167 371564
  .. ..$ yrange: num [1:2] 8246335 8249255
  .. ..$ bdry  :List of 1
  .. .. ..$ :List of 2
  .. .. .. ..$ x: num [1:17] 371564 371520 371370 371087 368410 ...
  .. .. .. ..$ y: num [1:17] 8248172 8249235 8249252 8249255 8249248 ...
  .. ..$ units :List of 3
  .. .. ..$ singular  : chr "unit"
  .. .. ..$ plural    : chr "units"
  .. .. ..$ multiplier: num 1
  .. .. ..- attr(*, "class")= chr "units"
  .. ..- attr(*, "class")= chr "owin"
  ..$ n         : int 906
  ..$ x         : num [1:906] 370662 368804 370729 370616 369597 ...
  ..$ y         : num [1:906] 8246749 8246960 8247257 8247999 8248656 ...
  ..$ markformat: chr "none"
  ..- attr(*, "class")= chr "ppp"

-- 
======================================================================
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)
e-mails:alexandresantosbr em yahoo.com.br
        alexandre.santos em cas.ifmt.edu.br
Lattes: http://lattes.cnpq.br/1360403201088680
======================================================================

_______________________________________________
R-br mailing list
R-br em listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código mínimo reproduzível.




_______________________________________________
R-br mailing list
R-br em listas.c3sl.ufpr.br
https://listas.inf.ufpr.br/cgi-bin/mailman/listinfo/r-br
Leia o guia de postagem (http://www.leg.ufpr.br/r-br-guia) e forneça código mínimo reproduzível.


-- 
======================================================================
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)
e-mails:alexandresantosbr em yahoo.com.br 
        alexandre.santos em cas.ifmt.edu.br 
Lattes: http://lattes.cnpq.br/1360403201088680                   
======================================================================



Mais detalhes sobre a lista de discussão R-br