# convexHull: Plots the convexhull polygon from the data (latitude,... In Irescale: Calculate and Rectify Moran's I

## Description

`convexHull` Computes the area and centroid of the convex hull from the (latitute, longitude) vector. It provides a plot of how the points are dispersed in the field of interest.

## Usage

 `1` ```convexHull(X, varOfInterest) ```

## Arguments

 `X` dataframe with two colums, latitute and longitude respectively. `varOfInterest` variable of interest to plot. This variable is needed to color the points on the convexhull.

## Details

Consideration for this function:

• It makes usage of chull from rgeos and Polygon from graphics.

• The centroid of the polygon is calculated by averaging the vertices of it.

• The shown plot uses the basic `plot` command.

## Value

A vector with two elements, the first element is the area and the second one is the centroid. The centroid is a list of two elements, latitude and longitude that represents the centroid. To have a visual idea of the returned object, it has the following shape [area,[latitude,longitude], plotObject].

## Examples

 ```1 2 3``` ```fileInput <- system.file("testdata", "chen.csv", package="Irescale") data<-loadFile(fileInput) area_centroid<-convexHull(data\$data,data\$varOfInterest) ```

### Example output ```Warning messages:
1: Use of `X[]` is discouraged. Use `.data[]` instead.
2: Use of `X[]` is discouraged. Use `.data[]` instead.
3: Use of `pol[]` is discouraged. Use `.data[]` instead.
4: Use of `pol[]` is discouraged. Use `.data[]` instead.
```

Irescale documentation built on Nov. 22, 2019, 1:07 a.m.