Dear R-users,
Im currently trying to extract the value of a slot (area) but cant find out
how to do that.
>str(overlperc)
List of 1
$ :Formal class 'SpatialPolygons' [package "sp"] with 4 slots
.. ..@ polygons :List of 1
.. .. ..$ :Formal class 'Polygons' [package "sp"] with 5 slots
.. .. .. .. ..@ Polygons :List of 1
.. .. .. .. .. ..$ :Formal class 'Polygon' [package "sp"] with 5 slots
.. .. .. .. .. .. .. ..@ labpt : num [1:2] 709374 -1507888
.. .. .. .. .. .. .. ..@ area : num 11542604
.. .. .. .. .. .. .. ..@ hole : logi FALSE
.. .. .. .. .. .. .. ..@ ringDir: int 1
.. .. .. .. .. .. .. ..@ coords : num [1:23, 1:2] 706840 706657 706840 707294
707585 ...
.. .. .. .. .. .. .. .. ..- attr(*, "dimnames")=List of 2
.. .. .. .. .. .. .. .. .. ..$ : chr [1:23] "1" "2" "3" "4" ...
.. .. .. .. .. .. .. .. .. ..$ : chr [1:2] "x" "y"
.. .. .. .. ..@ plotOrder: int 1
.. .. .. .. ..@ labpt : num [1:2] 709374 -1507888
.. .. .. .. ..@ ID : chr "1"
.. .. .. .. ..@ area : num 11542604
.. ..@ plotOrder : int 1
.. ..@ bbox : num [1:2, 1:2] 706657 -1509411 711710 -1506189
.. .. ..- attr(*, "dimnames")=List of 2
.. .. .. ..$ : chr [1:2] "x" "y"
.. .. .. ..$ : chr [1:2] "min" "max"
.. ..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slots
.. .. .. ..@ projargs: chr NA
Id like to extract the area value so as to be able to use this value for
further analysis. Heres below what I get when I only type the name of the
object:
>overlperc
[[1]]
An object of class "SpatialPolygons"
Slot "polygons":
[[1]]
An object of class "Polygons"
Slot "Polygons":
[[1]]
An object of class "Polygon"
Slot "labpt":
[1] 709374 -1507888
Slot "area":
[1] 11542604
Slot "hole":
[1] FALSE
Slot "ringDir":
[1] 1
Slot "coords":
x y
1 706839.8 -1508654
2 706657.2 -1508029
3 706839.8 -1507634
4 707293.6 -1507284
5 707584.7 -1507174
6 708329.6 -1506851
7 709013.3 -1506539
8 709074.5 -1506513
9 709819.5 -1506189
10 710564.4 -1506289
11 711021.1 -1506539
12 711309.3 -1506769
13 711642.0 -1507284
14 711709.8 -1508029
15 711309.3 -1508690
16 711246.4 -1508774
17 710564.4 -1509347
18 709819.5 -1509411
19 709074.5 -1509277
20 708329.6 -1509072
21 707584.7 -1509039
22 706927.4 -1508774
23 706839.8 -1508654
Slot "plotOrder":
[1] 1
Slot "labpt":
[1] 709374 -1507888
Slot "ID":
[1] "1"
Slot "area":
[1] 11542604
Slot "plotOrder":
[1] 1
Slot "bbox":
min max
x 706657.2 711709.8
y -1509411.3 -1506189.0
Slot "proj4string":
CRS arguments: NA
Im stuck and spent more or less the whole afternoon online trying to find a
solution to my problem but I couldnt find anything. I look forward to hear
from some of you. Thanks in advance for your kind help.
Have a good weekend.
Cheers
Xavier
Xavier Hoenner
PhD Student
Nesting Ecology, Migrations and Diving Behaviour of Hawksbill Turtles
School of Environmental Research, Charles Darwin University
Darwin, NT 0909
Ph: (08)8946.7721
email:[email protected]
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.