Description Usage Arguments Value Examples
View source: R/spatial_stats.R
Computes spatial autocorrelation for a single sample and single variable (sssv) from a data frame with three columns (longitude, latitude, and measurement). Uses inverse of distance between points in Moran's I calculation.
1 2 3 4 5 6 | calc_moransI(
df_sssv,
lon_col = "longitude",
lat_col = "latitude",
meas_col = "Measurement"
)
|
df_sssv |
data frame with spatial measurements of a single sample and single variable |
lon_col |
character string, column name for longitude column |
lat_col |
character string, column name for latitude column |
meas_col |
character string, column name for measurement column |
numeric, the Moran's I (spatial autocorrelation)
1 2 3 4 5 6 7 8 9 10 11 | example_data <- data.frame(
lon = runif(n = 10, min = -90, max = -85),
lat = runif(n = 10, min = 45, max = 46),
meas = rnorm(10)
)
calc_moransI(example_data, lon_col = "lon", lat_col = "lat", meas_col = "meas")
peter_lake_data <- flame_data %>%
dplyr::filter(Lake == "R" & Date == as.Date("2019-07-22")) %>%
dplyr::select(latitude, longitude, BGApc_ugL_tau)
calc_moransI(peter_lake_data, meas_col = "BGApc_ugL_tau")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.