lat_lon_to_osi: Simpson's, Shannon, and Camargo evenness

Description Usage Arguments Details Value See Also Examples

View source: R/lat_lon_to_osi.R View source: R/evenness_metrics.R

Description

Measure evenness using Simpson's, Shannon, and Camargo evenness

Convert latitude/longitude to eastings and northings on the Irish OSI TM75 grid.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
lat_lon_to_osi(
  x,
  lat = "Latitude",
  lon = "Longitude",
  orig_crs = NULL,
  precision = 1
)

lat_lon_to_osi(
  x,
  lat = "Latitude",
  lon = "Longitude",
  orig_crs = NULL,
  precision = 1
)

Arguments

x

A data frame containing latitude and longitude coordinates.

lat, lon

Character string giving the names of the latitude and longitude columns.

orig_crs

A character string giving the proj4string specifying the coordinate reference system that the original lat/lon coordinates are in.

precision

Integer giving the desired precision (in meters) of results

Details

This function implements the Simpson's, Shannon, and Camargo evenness metrics.

This function calls spTransform to convert latitude/longitude coordinates from WGS84 or some other specified CRS to the Irish OSI TM75 grid. The proj4string for the CRS of the original coordinates must be specified in orig_crs. (e.g. "+init=epsg:4326" for WGS 84).

Use precision_meters to find the hectad or 1km block in which the original coordinates lie. For example, precision_meters = 1 gives results precise to 1 meter, and precision_meters = 10000 gives the eastings/northings of the hectad in which the original coordinates lie.

The main purpose of this function is to make this slightly more automatic for Willson's PhD work by providing the destination epsg:29903 code in the function. The function also re-names the output coordinate fields to 'eastings' and 'northings'.

Value

a data frame with all rows and all columns of x, plus two additional columns for eastings and northings.

a data frame with all rows and all columns of x, plus two additional columns for eastings and northings.

See Also

spTransform, CRS, rgdal, proj4string, http://spatialreference.org/ref/epsg/tm75-irish-grid/

Examples

1
2
3
4
5
6
7
set.seed(500)
df <- data.frame(site = c("A", "B", "C", "D", "E"),
                 Latitude = rnorm(mean = 54.3, sd = 1, 5),
                 Longitude = rnorm(mean = -6, sd = 0.5, 5))
df <- lat_lon_to_osi(df, orig_crs = "+init=epsg:4326")
plot(df$Latitude ~ df$Longitude)
plot(df$northings ~ df$eastings)

wgaul/wgutil documentation built on June 1, 2020, 3:39 a.m.