[R-sig-Geo] [FORGED] R Help
Rolf Turner
r@turner @ending from @uckl@nd@@c@nz
Thu Dec 20 23:47:10 CET 2018
On 12/21/18 10:56 AM, Esu Esu via R-sig-Geo wrote:
> Dear All,
> I am new to R-programming.
Learn to crawl before you start trying to walk or run. Study some of
the many R tutorials that are available.
> I have question if anyone can help me with:Q: how can I create functions in R to compute the area
> (A), centroid (Cx and Cy) and perimeter (P) of a polygon list . I want to write R functions to
> compute these quantities for individual polygons, as well asan overall function to take a polygon
> list and return a data frame with four columns and the samenumber of rows as polygons in the list.
> Each quantity should correspond to each column. it is (sp) class object. > Hope to find any suggestion or answer
The spatstat package will enable you to do all this pretty easily. See
?centroid.owin
?perimeter
?area.owin
You will need to convert your polygons to objects of class "owin". The
as.owin() function should handle this for you.
cheers,
Rolf Turner
--
Technical Editor ANZJS
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276
More information about the R-sig-Geo
mailing list