From 1c14030fd747b3c88930d3ab72e94f4729ce3911 Mon Sep 17 00:00:00 2001
From: Xun Li <lixun910@gmail.com>
Date: Sat, 9 Apr 2022 23:44:39 -0700
Subject: [PATCH] Fix cran warnings (#34)

* use inherits() to replace comparing class() to string

* update libgeoda to fix cran warning

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

* update date
---
 DESCRIPTION  | 2 +-
 R/weights.R  | 6 +++---
 src/libgeoda | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/DESCRIPTION b/DESCRIPTION
index 772378de..658071ee 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -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"))
diff --git a/R/weights.R b/R/weights.R
index 8d7e8c09..ec6af915 100644
--- a/R/weights.R
+++ b/R/weights.R
@@ -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)
 
@@ -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)
   }
 
@@ -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)
   }
 
diff --git a/src/libgeoda b/src/libgeoda
index d226effd..a9a3d0a3 160000
--- a/src/libgeoda
+++ b/src/libgeoda
@@ -1 +1 @@
-Subproject commit d226effd9171279713fe46750221919467a3f3a4
+Subproject commit a9a3d0a3212dfc7cdc63d41f5e8033ba54063693