Skip to content

Commit

Permalink
Fix cran warnings (#34)
Browse files Browse the repository at this point in the history
* use inherits() to replace comparing class() to string

* update libgeoda to fix cran warning

Signed-off-by: Xun Li <lixun910@gmail.com>

* update date
  • Loading branch information
lixun910 authored Apr 10, 2022
1 parent 0b50ded commit 1c14030
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Package: rgeoda
Type: Package
Title: R Library for Spatial Data Analysis
Version: 0.0.9
Date: 2022-04-04
Date: 2022-04-09
Authors@R:
c(person(given = "Xun", family = "Li", email="lixun910@gmail.com", role=c("aut","cre")),
person(given = "Luc", family = "Anselin", email="anselin@uchicago.edu", role="aut"))
Expand Down
6 changes: 3 additions & 3 deletions R/weights.R
Original file line number Diff line number Diff line change
Expand Up @@ -968,7 +968,7 @@ gda_kernel_knn_weights <- function(geoda_obj, k, kernel_method,
#' @return A matrix object
#' @export
as.matrix.Weight <- function(x, rownames=NULL, rownames.value=NULL, ...) {
if (length(class(x)) == 1 && class(x) == "Weight") {
if (length(class(x)) == 1 && inherits(x, "Weight")) {
n <- x$num_obs
m <- matrix(0, nrow = n, ncol = n)

Expand Down Expand Up @@ -1010,7 +1010,7 @@ read_gal <- function(file_path, id_vec = c()) {
id_vec <- 0 : num_obs - 1
}

if (class(id_vec) == "numeric") {
if (inherits(id_vec, "numeric")) {
id_vec <- as.character(id_vec)
}

Expand Down Expand Up @@ -1040,7 +1040,7 @@ read_gwt <- function(file_path, id_vec = c()) {
id_vec <- 0 : num_obs - 1
}

if (class(id_vec) == "numeric") {
if (inherits(id_vec, "numeric")) {
id_vec <- as.character(id_vec)
}

Expand Down
2 changes: 1 addition & 1 deletion src/libgeoda

0 comments on commit 1c14030

Please sign in to comment.