Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: spmodel
Title: Spatial Statistical Modeling and Prediction
Version: 0.11.0
Version: 0.11.1
Authors@R: c(
person(given = "Michael",
family = "Dumelle",
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# spmodel 0.11.1

## Minor Updates

* Added a warning message when `splm()` or `spglm()` converts a non-`POINT` geometry to a `POINT` geometry using `sf::st_centroid()`.
* Updated a warning message when `splm()` or `spglm()` compute distances using a geographic coordinate system (and not a projected coordinate system).

## Bug Fixes

* Fixed a bug in the cloud semivariogram (i.e., `esv(..., cloud = TRUE)`) that incorrectly doubled the semivariance.
* Fix `\textbf`, `\textsf`, and `\textttt` LaTeX rendering issues in vignettes ([#36](https://github.com/USEPA/spmodel/issues/36)).

# spmodel 0.11.0

## Major Updates
Expand Down
8 changes: 5 additions & 3 deletions R/get_data_object.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ get_data_object_splm <- function(formula, data, spcov_initial, xcoord, ycoord, e
is_sf <- TRUE
sf_column_name <- attributes(data)$sf_column
crs <- attributes(data[[sf_column_name]])$crs
if (!inherits(spcov_initial, c("none", "ie")) && any(sf::st_geometry_type(data) != "POINT")) {
warning("At least one geometry type in data is not equal to \"POINT\". Attempting to coerce all non-\"POINT\" geometries to \"POINT\" geometries via their centroids using sf::st_centroid().", call. = FALSE)
}
data_sf <- suppressWarnings(sf::st_centroid(data))
# store as data frame
data <- sf_to_df(data_sf)
Expand Down Expand Up @@ -93,13 +96,12 @@ get_data_object_splm <- function(formula, data, spcov_initial, xcoord, ycoord, e
# check if coordinates are projected
if (is_sf) {
if (!is.na(st_is_longlat(crs)) && st_is_longlat(crs)) {
warning("Coordinates are in a geographic coordinate system. For the most accurate results, please ensure
coordinates are in a projected coordinate system (e.g., via sf::st_transform()).", call. = FALSE)
warning("Coordinates are in a geographic coordinate system and will be used as is. For the most accurate results, please ensure coordinates are in a projected coordinate system (e.g., via sf::st_transform()).", call. = FALSE)
}
} else {
# possible revisit this later and add explicit warning
# if (any(abs(c(data[[xcoord]], data[[ycoord]])) <= 360)) {
# warning("Coordinates may be in a geographic coordinate system. For the most accurate results, please ensure
# warning("Coordinates may be in a geographic coordinate system and will be used as is. For the most accurate results, please ensure
# coordinates are in a projected coordinate system (e.g., via sf::st_transform()).", call. = FALSE)
# }
}
Expand Down
8 changes: 5 additions & 3 deletions R/get_data_object_glm.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ get_data_object_spglm <- function(formula, family, data, spcov_initial, xcoord,
is_sf <- TRUE
sf_column_name <- attributes(data)$sf_column
crs <- attributes(data[[sf_column_name]])$crs
if (!inherits(spcov_initial, c("none", "ie")) && any(sf::st_geometry_type(data) != "POINT")) {
warning("At least one geometry type in data is not equal to \"POINT\". Attempting to coerce all non-\"POINT\" geometries to \"POINT\" geometries via their centroids using sf::st_centroid().", call. = FALSE)
}
data_sf <- suppressWarnings(sf::st_centroid(data))
# store as data frame
data <- sf_to_df(data_sf)
Expand Down Expand Up @@ -94,13 +97,12 @@ get_data_object_spglm <- function(formula, family, data, spcov_initial, xcoord,
# check if coordinates are projected
if (is_sf) {
if (!is.na(st_is_longlat(crs)) && st_is_longlat(crs)) {
warning("Coordinates are in a geographic coordinate system. For the most accurate results, please ensure
coordinates are in a projected coordinate system (e.g., via sf::st_transform()).", call. = FALSE)
warning("Coordinates are in a geographic coordinate system and will be used as is. For the most accurate results, please ensure coordinates are in a projected coordinate system (e.g., via sf::st_transform()).", call. = FALSE)
}
} else {
# possible revisit this later and add explicit warning
# if (any(abs(c(data[[xcoord]], data[[ycoord]])) <= 360)) {
# warning("Coordinates may be in a geographic coordinate system. For the most accurate results, please ensure
# warning("Coordinates may be in a geographic coordinate system and will be used as is. For the most accurate results, please ensure
# coordinates are in a projected coordinate system (e.g., via sf::st_transform()).", call. = FALSE)
# }
}
Expand Down
2 changes: 1 addition & 1 deletion R/get_esv.R
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ get_esv_robust <- function(residual_vector12, dist_vector, bins, cutoff, formula

get_esv_cloud <- function(residual_vector2, dist_vector, formula) {

esv_out <- tibble::tibble(dist = dist_vector, gamma = residual_vector2)
esv_out <- tibble::tibble(dist = dist_vector, gamma = residual_vector2 / 2)

# set row names to NULL
# row.names(esv_out) <- NULL
Expand Down
2 changes: 1 addition & 1 deletion R/sf_to_df.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#' Turn an \code{sf} object into a data frame
#'
#' @param data An \code{sf} object with all \code{POINT} geometries or geometries
#' coercible to \code{POINT} geometries via sf::st_centriod().
#' coercible to \code{POINT} geometries via sf::st_centroid().
#'
#' @return A data frame with coordinates added as columns
#'
Expand Down
2 changes: 1 addition & 1 deletion docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/LICENSE.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading