diff --git a/.Rbuildignore b/.Rbuildignore index 9d8e7412..6d1f529f 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -14,3 +14,6 @@ ^src/libgeoda/README.md ^src/libgeoda/.git ^\.github$ +^_pkgdown\.yml$ +^docs$ +^pkgdown$ diff --git a/.gitignore b/.gitignore index cd3c5d97..809d243f 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,4 @@ vignettes/*.pdf *.so .DS_Store .DS_Store +docs diff --git a/DESCRIPTION b/DESCRIPTION index 9b637f54..772378de 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: rgeoda Type: Package Title: R Library for Spatial Data Analysis -Version: 0.0.8-6 -Date: 2021-09-07 +Version: 0.0.9 +Date: 2022-04-04 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/RcppExports.R b/R/RcppExports.R index e7763bb3..d478ba63 100644 --- a/R/RcppExports.R +++ b/R/RcppExports.R @@ -1,40 +1,40 @@ # Generated by using Rcpp::compileAttributes() -> do not edit by hand # Generator token: 10BE3573-1514-4C36-9D1C-5A225CD40393 -p_skater <- function(k, xp_w, data, n_vars, scale_method, distance_method, bound_vals, min_bound, seed, cpu_threads) { - .Call('_rgeoda_p_skater', PACKAGE = 'rgeoda', k, xp_w, data, n_vars, scale_method, distance_method, bound_vals, min_bound, seed, cpu_threads) +p_skater <- function(k, xp_w, data, n_vars, scale_method, distance_method, bound_vals, min_bound, seed, cpu_threads, rdist) { + .Call('_rgeoda_p_skater', PACKAGE = 'rgeoda', k, xp_w, data, n_vars, scale_method, distance_method, bound_vals, min_bound, seed, cpu_threads, rdist) } -p_redcap <- function(k, xp_w, data, n_vars, redcap_method, scale_method, distance_method, bound_vals, min_bound, seed, cpu_threads) { - .Call('_rgeoda_p_redcap', PACKAGE = 'rgeoda', k, xp_w, data, n_vars, redcap_method, scale_method, distance_method, bound_vals, min_bound, seed, cpu_threads) +p_redcap <- function(k, xp_w, data, n_vars, redcap_method, scale_method, distance_method, bound_vals, min_bound, seed, cpu_threads, rdist) { + .Call('_rgeoda_p_redcap', PACKAGE = 'rgeoda', k, xp_w, data, n_vars, redcap_method, scale_method, distance_method, bound_vals, min_bound, seed, cpu_threads, rdist) } -p_schc <- function(k, xp_w, data, n_vars, linkage_method, scale_method, distance_method, bound_vals, min_bound) { - .Call('_rgeoda_p_schc', PACKAGE = 'rgeoda', k, xp_w, data, n_vars, linkage_method, scale_method, distance_method, bound_vals, min_bound) +p_schc <- function(k, xp_w, data, n_vars, linkage_method, scale_method, distance_method, bound_vals, min_bound, rdist) { + .Call('_rgeoda_p_schc', PACKAGE = 'rgeoda', k, xp_w, data, n_vars, linkage_method, scale_method, distance_method, bound_vals, min_bound, rdist) } -p_maxp_greedy <- function(xp_w, data, n_vars, bound_vals, min_bound, iterations, init_regions, scale_method, distance_method, seed, cpu_threads) { - .Call('_rgeoda_p_maxp_greedy', PACKAGE = 'rgeoda', xp_w, data, n_vars, bound_vals, min_bound, iterations, init_regions, scale_method, distance_method, seed, cpu_threads) +p_maxp_greedy <- function(xp_w, data, n_vars, bound_vals, min_bound, iterations, init_regions, scale_method, distance_method, seed, cpu_threads, rdist) { + .Call('_rgeoda_p_maxp_greedy', PACKAGE = 'rgeoda', xp_w, data, n_vars, bound_vals, min_bound, iterations, init_regions, scale_method, distance_method, seed, cpu_threads, rdist) } -p_maxp_sa <- function(xp_w, data, n_vars, bound_vals, min_bound, iterations, cooling_rate, sa_maxit, init_regions, scale_method, distance_method, seed, cpu_threads) { - .Call('_rgeoda_p_maxp_sa', PACKAGE = 'rgeoda', xp_w, data, n_vars, bound_vals, min_bound, iterations, cooling_rate, sa_maxit, init_regions, scale_method, distance_method, seed, cpu_threads) +p_maxp_sa <- function(xp_w, data, n_vars, bound_vals, min_bound, iterations, cooling_rate, sa_maxit, init_regions, scale_method, distance_method, seed, cpu_threads, rdist) { + .Call('_rgeoda_p_maxp_sa', PACKAGE = 'rgeoda', xp_w, data, n_vars, bound_vals, min_bound, iterations, cooling_rate, sa_maxit, init_regions, scale_method, distance_method, seed, cpu_threads, rdist) } -p_maxp_tabu <- function(xp_w, data, n_vars, bound_vals, min_bound, iterations, tabu_length, conv_tabu, init_regions, scale_method, distance_method, seed, cpu_threads) { - .Call('_rgeoda_p_maxp_tabu', PACKAGE = 'rgeoda', xp_w, data, n_vars, bound_vals, min_bound, iterations, tabu_length, conv_tabu, init_regions, scale_method, distance_method, seed, cpu_threads) +p_maxp_tabu <- function(xp_w, data, n_vars, bound_vals, min_bound, iterations, tabu_length, conv_tabu, init_regions, scale_method, distance_method, seed, cpu_threads, rdist) { + .Call('_rgeoda_p_maxp_tabu', PACKAGE = 'rgeoda', xp_w, data, n_vars, bound_vals, min_bound, iterations, tabu_length, conv_tabu, init_regions, scale_method, distance_method, seed, cpu_threads, rdist) } -p_azp_greedy <- function(p, xp_w, data, n_vars, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed) { - .Call('_rgeoda_p_azp_greedy', PACKAGE = 'rgeoda', p, xp_w, data, n_vars, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed) +p_azp_greedy <- function(p, xp_w, data, n_vars, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed, rdist) { + .Call('_rgeoda_p_azp_greedy', PACKAGE = 'rgeoda', p, xp_w, data, n_vars, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed, rdist) } -p_azp_sa <- function(p, xp_w, data, n_vars, cooling_rate, sa_maxit, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed) { - .Call('_rgeoda_p_azp_sa', PACKAGE = 'rgeoda', p, xp_w, data, n_vars, cooling_rate, sa_maxit, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed) +p_azp_sa <- function(p, xp_w, data, n_vars, cooling_rate, sa_maxit, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed, rdist) { + .Call('_rgeoda_p_azp_sa', PACKAGE = 'rgeoda', p, xp_w, data, n_vars, cooling_rate, sa_maxit, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed, rdist) } -p_azp_tabu <- function(p, xp_w, data, n_vars, tabu_length, conv_tabu, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed) { - .Call('_rgeoda_p_azp_tabu', PACKAGE = 'rgeoda', p, xp_w, data, n_vars, tabu_length, conv_tabu, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed) +p_azp_tabu <- function(p, xp_w, data, n_vars, tabu_length, conv_tabu, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed, rdist) { + .Call('_rgeoda_p_azp_tabu', PACKAGE = 'rgeoda', p, xp_w, data, n_vars, tabu_length, conv_tabu, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed, rdist) } p_spatialvalidation <- function(xp_geoda, clusters, xp_w) { diff --git a/R/clustering.R b/R/clustering.R index af1e6e0f..a33b45d6 100644 --- a/R/clustering.R +++ b/R/clustering.R @@ -11,7 +11,7 @@ #' @param distance_method (optional) The distance method used to compute the distance betwen observation i and j. Defaults to "euclidean". Options are "euclidean" and "manhattan" #' @param random_seed (int,optional) The seed for random number generator. Defaults to 123456789. #' @param cpu_threads (optional) The number of cpu threads used for parallel computation -#' @return A list of numeric vectors represents a group of clusters +#' @param rdist (optional) The distance matrix (lower triangular matrix, column wise storage) #' @return A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". #' @examples #' library(sf) @@ -22,7 +22,7 @@ #' guerry_clusters <- skater(4, queen_w, data) #' guerry_clusters #' @export -skater <- function(k, w, df, bound_variable=data.frame(), min_bound=0, scale_method="standardize", distance_method="euclidean", random_seed=123456789, cpu_threads=6) { +skater <- function(k, w, df, bound_variable=data.frame(), min_bound=0, scale_method="standardize", distance_method="euclidean", random_seed=123456789, cpu_threads=6, rdist=numeric()) { if (w$num_obs < 1) { stop("The weights is not valid.") } @@ -56,7 +56,7 @@ skater <- function(k, w, df, bound_variable=data.frame(), min_bound=0, scale_met if (length(bound_variable) > 0) { bound_values <- bound_variable[[1]] } - return(p_skater(k, w$GetPointer(), df, n_vars, scale_method, distance_method, bound_values, min_bound, random_seed, cpu_threads)) + return(p_skater(k, w$GetPointer(), df, n_vars, scale_method, distance_method, bound_values, min_bound, random_seed, cpu_threads, rdist)) } @@ -74,6 +74,7 @@ skater <- function(k, w, df, bound_variable=data.frame(), min_bound=0, scale_met #' @param min_bound (optional) A minimum bound value that applies to all clusters #' @param scale_method One of the scaling methods {'raw', 'standardize', 'demean', 'mad', 'range_standardize', 'range_adjust'} to apply on input data. Default is 'standardize' (Z-score normalization). #' @param distance_method (optional) The distance method used to compute the distance betwen observation i and j. Defaults to "euclidean". Options are "euclidean" and "manhattan" +#' @param rdist (optional) The distance matrix (lower triangular matrix, column wise storage) #' @return A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". #' @examples #' library(sf) @@ -84,7 +85,7 @@ skater <- function(k, w, df, bound_variable=data.frame(), min_bound=0, scale_met #' guerry_clusters <- schc(4, queen_w, data, "complete") #' guerry_clusters #' @export -schc <- function(k, w, df, method="average", bound_variable=data.frame(), min_bound=0, scale_method="standardize", distance_method="euclidean") { +schc <- function(k, w, df, method="average", bound_variable=data.frame(), min_bound=0, scale_method="standardize", distance_method="euclidean", rdist=numeric()) { if (w$num_obs < 1) { stop("The weights is not valid.") } @@ -124,7 +125,7 @@ schc <- function(k, w, df, method="average", bound_variable=data.frame(), min_bo bound_values <- bound_variable[[1]] } - return(p_schc(k, w$GetPointer(), df, n_vars, scale_method, method, distance_method, bound_values, min_bound)) + return(p_schc(k, w$GetPointer(), df, n_vars, scale_method, method, distance_method, bound_values, min_bound, rdist)) } @@ -152,6 +153,7 @@ schc <- function(k, w, df, method="average", bound_variable=data.frame(), min_bo #' @param distance_method (optional) The distance method used to compute the distance betwen observation i and j. Defaults to "euclidean". Options are "euclidean" and "manhattan" #' @param random_seed (int,optional) The seed for random number generator. Defaults to 123456789. #' @param cpu_threads (optional) The number of cpu threads used for parallel computation +#' @param rdist (optional) The distance matrix (lower triangular matrix, column wise storage) #' @return A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". #' @examples #' \dontrun{ @@ -164,7 +166,7 @@ schc <- function(k, w, df, method="average", bound_variable=data.frame(), min_bo #' guerry_clusters #' } #' @export -redcap <- function(k, w, df, method="fullorder-averagelinkage", bound_variable=data.frame(), min_bound=0, scale_method="standardize", distance_method="euclidean", random_seed=123456789, cpu_threads=6) { +redcap <- function(k, w, df, method="fullorder-averagelinkage", bound_variable=data.frame(), min_bound=0, scale_method="standardize", distance_method="euclidean", random_seed=123456789, cpu_threads=6, rdist=numeric()) { if (w$num_obs < 1) { stop("The weights is not valid.") } @@ -204,7 +206,7 @@ redcap <- function(k, w, df, method="fullorder-averagelinkage", bound_variable=d bound_values <- bound_variable[[1]] } - return(p_redcap(k, w$GetPointer(), df, n_vars, method, scale_method, distance_method, bound_values, min_bound, random_seed, cpu_threads)) + return(p_redcap(k, w$GetPointer(), df, n_vars, method, scale_method, distance_method, bound_values, min_bound, random_seed, cpu_threads, rdist)) } ############################################################ @@ -223,6 +225,7 @@ redcap <- function(k, w, df, method="fullorder-averagelinkage", bound_variable=d #' @param distance_method (optional) The distance method used to compute the distance betwen observation i and j. Defaults to "euclidean". Options are "euclidean" and "manhattan" #' @param random_seed (optional) The seed for random number generator. Defaults to 123456789. #' @param cpu_threads (optional) The number of cpu threads used for parallel computation +#' @param rdist (optional) The distance matrix (lower triangular matrix, column wise storage) #' @return A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". #' @examples #' \dontrun{ @@ -237,7 +240,7 @@ redcap <- function(k, w, df, method="fullorder-averagelinkage", bound_variable=d #' maxp_clusters #' } #' @export -maxp_greedy <- function(w, df, bound_variable, min_bound, iterations=99, initial_regions=vector('numeric'), scale_method="standardize", distance_method="euclidean", random_seed=123456789, cpu_threads=6) { +maxp_greedy <- function(w, df, bound_variable, min_bound, iterations=99, initial_regions=vector('numeric'), scale_method="standardize", distance_method="euclidean", random_seed=123456789, cpu_threads=6, rdist=numeric()) { if (w$num_obs < 1) { stop("The weights is not valid.") } @@ -277,7 +280,7 @@ maxp_greedy <- function(w, df, bound_variable, min_bound, iterations=99, initial bound_values <- bound_variable[[1]] } - return(p_maxp_greedy(w$GetPointer(), df, n_vars, bound_values, min_bound, iterations, initial_regions, scale_method, distance_method, random_seed, cpu_threads)) + return(p_maxp_greedy(w$GetPointer(), df, n_vars, bound_values, min_bound, iterations, initial_regions, scale_method, distance_method, random_seed, cpu_threads, rdist)) } ############################################################ @@ -298,6 +301,7 @@ maxp_greedy <- function(w, df, bound_variable, min_bound, iterations=99, initial #' @param random_seed (optional) The seed for random number generator. Defaults to 123456789. #' @param initial_regions (optional): The initial regions that the local search starts with. Default is empty. means the local search starts with a random process to "grow" clusters #' @param cpu_threads (optional) The number of cpu threads used for parallel computation +#' @param rdist (optional) The distance matrix (lower triangular matrix, column wise storage) #' @return A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". #' @examples #' \dontrun{ @@ -312,7 +316,7 @@ maxp_greedy <- function(w, df, bound_variable, min_bound, iterations=99, initial #' maxp_clusters #' } #' @export -maxp_sa <- function(w, df, bound_variable, min_bound, cooling_rate, sa_maxit=1, iterations=99, initial_regions=vector('numeric'), scale_method="standardize", distance_method="euclidean", random_seed=123456789, cpu_threads=6) { +maxp_sa <- function(w, df, bound_variable, min_bound, cooling_rate, sa_maxit=1, iterations=99, initial_regions=vector('numeric'), scale_method="standardize", distance_method="euclidean", random_seed=123456789, cpu_threads=6, rdist=numeric()) { if (w$num_obs < 1) { stop("The weights is not valid.") } @@ -352,7 +356,7 @@ maxp_sa <- function(w, df, bound_variable, min_bound, cooling_rate, sa_maxit=1, bound_values <- bound_variable[[1]] } - return(p_maxp_sa(w$GetPointer(), df, n_vars, bound_values, min_bound, iterations, cooling_rate, sa_maxit, initial_regions, scale_method, distance_method, random_seed, cpu_threads)) + return(p_maxp_sa(w$GetPointer(), df, n_vars, bound_values, min_bound, iterations, cooling_rate, sa_maxit, initial_regions, scale_method, distance_method, random_seed, cpu_threads, rdist)) } ############################################################ @@ -373,6 +377,7 @@ maxp_sa <- function(w, df, bound_variable, min_bound, cooling_rate, sa_maxit=1, #' @param random_seed (optional) The seed for random number generator. Defaults to 123456789. #' @param initial_regions (optional): The initial regions that the local search starts with. Default is empty. means the local search starts with a random process to "grow" clusters #' @param cpu_threads (optional) The number of cpu threads used for parallel computation +#' @param rdist (optional) The distance matrix (lower triangular matrix, column wise storage) #' @return A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". #' @examples #' \dontrun{ @@ -387,7 +392,7 @@ maxp_sa <- function(w, df, bound_variable, min_bound, cooling_rate, sa_maxit=1, #' maxp_clusters #' } #' @export -maxp_tabu <- function(w, df, bound_variable, min_bound, tabu_length=10, conv_tabu=10, iterations=99, initial_regions=vector('numeric'), scale_method="standardize", distance_method="euclidean", random_seed=123456789, cpu_threads=6) { +maxp_tabu <- function(w, df, bound_variable, min_bound, tabu_length=10, conv_tabu=10, iterations=99, initial_regions=vector('numeric'), scale_method="standardize", distance_method="euclidean", random_seed=123456789, cpu_threads=6, rdist=numeric()) { if (w$num_obs < 1) { stop("The weights is not valid.") } @@ -427,7 +432,7 @@ maxp_tabu <- function(w, df, bound_variable, min_bound, tabu_length=10, conv_tab bound_values <- bound_variable[[1]] } - return(p_maxp_tabu(w$GetPointer(), df, n_vars, bound_values, min_bound, iterations, tabu_length, conv_tabu, initial_regions, scale_method, distance_method, random_seed, cpu_threads)) + return(p_maxp_tabu(w$GetPointer(), df, n_vars, bound_values, min_bound, iterations, tabu_length, conv_tabu, initial_regions, scale_method, distance_method, random_seed, cpu_threads, rdist)) } ############################################################ @@ -443,6 +448,7 @@ maxp_tabu <- function(w, df, bound_variable, min_bound, tabu_length=10, conv_tab #' @param scale_method (optional) One of the scaling methods {'raw', 'standardize', 'demean', 'mad', 'range_standardize', 'range_adjust'} to apply on input data. Default is 'standardize' (Z-score normalization). #' @param distance_method (optional) The distance method used to compute the distance betwen observation i and j. Defaults to "euclidean". Options are "euclidean" and "manhattan" #' @param random_seed (optional) The seed for random number generator. Defaults to 123456789. +#' @param rdist (optional) The distance matrix (lower triangular matrix, column wise storage) #' @return A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". #' @examples #' \dontrun{ @@ -455,7 +461,7 @@ maxp_tabu <- function(w, df, bound_variable, min_bound, tabu_length=10, conv_tab #' azp_clusters #' } #' @export -azp_greedy <- function(p, w, df, bound_variable=data.frame(), min_bound=0, inits=0, initial_regions=vector('numeric'), scale_method="standardize", distance_method="euclidean", random_seed=123456789) { +azp_greedy <- function(p, w, df, bound_variable=data.frame(), min_bound=0, inits=0, initial_regions=vector('numeric'), scale_method="standardize", distance_method="euclidean", random_seed=123456789, rdist=numeric()) { if (p < 0) { stop("The p should be a positive integer number.") } @@ -490,7 +496,7 @@ azp_greedy <- function(p, w, df, bound_variable=data.frame(), min_bound=0, inits bound_values <- bound_variable[[1]] } - return(p_azp_greedy(p, w$GetPointer(), df, n_vars, bound_values, min_bound, inits, initial_regions, scale_method, distance_method, random_seed)) + return(p_azp_greedy(p, w$GetPointer(), df, n_vars, bound_values, min_bound, inits, initial_regions, scale_method, distance_method, random_seed, rdist)) } ############################################################ @@ -508,6 +514,7 @@ azp_greedy <- function(p, w, df, bound_variable=data.frame(), min_bound=0, inits #' @param scale_method (optional) One of the scaling methods {'raw', 'standardize', 'demean', 'mad', 'range_standardize', 'range_adjust'} to apply on input data. Default is 'standardize' (Z-score normalization). #' @param distance_method (optional) The distance method used to compute the distance betwen observation i and j. Defaults to "euclidean". Options are "euclidean" and "manhattan" #' @param random_seed (optional) The seed for random number generator. Defaults to 123456789. +#' @param rdist (optional) The distance matrix (lower triangular matrix, column wise storage) #' @return A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". #' @examples #' \dontrun{ @@ -520,7 +527,7 @@ azp_greedy <- function(p, w, df, bound_variable=data.frame(), min_bound=0, inits #' azp_clusters #' } #' @export -azp_sa<- function(p, w, df, cooling_rate, sa_maxit=1, bound_variable=data.frame(), min_bound=0, inits=0, initial_regions=vector('numeric'), scale_method="standardize", distance_method="euclidean", random_seed=123456789) { +azp_sa<- function(p, w, df, cooling_rate, sa_maxit=1, bound_variable=data.frame(), min_bound=0, inits=0, initial_regions=vector('numeric'), scale_method="standardize", distance_method="euclidean", random_seed=123456789, rdist=numeric()) { if (p < 0) { stop("The p should be a positive integer number.") } @@ -555,7 +562,7 @@ azp_sa<- function(p, w, df, cooling_rate, sa_maxit=1, bound_variable=data.frame( bound_values <- bound_variable[[1]] } - return(p_azp_sa(p, w$GetPointer(), df, n_vars, cooling_rate, sa_maxit, bound_values, min_bound, inits, initial_regions, scale_method, distance_method, random_seed)) + return(p_azp_sa(p, w$GetPointer(), df, n_vars, cooling_rate, sa_maxit, bound_values, min_bound, inits, initial_regions, scale_method, distance_method, random_seed, rdist)) } ############################################################ @@ -573,6 +580,7 @@ azp_sa<- function(p, w, df, cooling_rate, sa_maxit=1, bound_variable=data.frame( #' @param scale_method (optional) One of the scaling methods {'raw', 'standardize', 'demean', 'mad', 'range_standardize', 'range_adjust'} to apply on input data. Default is 'standardize' (Z-score normalization). #' @param distance_method (optional) The distance method used to compute the distance betwen observation i and j. Defaults to "euclidean". Options are "euclidean" and "manhattan" #' @param random_seed (optional) The seed for random number generator. Defaults to 123456789. +#' @param rdist (optional) The distance matrix (lower triangular matrix, column wise storage) #' @return A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". #' @examples #' \dontrun{ @@ -585,7 +593,7 @@ azp_sa<- function(p, w, df, cooling_rate, sa_maxit=1, bound_variable=data.frame( #' azp_clusters #' } #' @export -azp_tabu<- function(p, w, df, tabu_length=10, conv_tabu=10, bound_variable=data.frame(), min_bound=0, inits=0, initial_regions=vector('numeric'), scale_method="standardize", distance_method="euclidean", random_seed=123456789) { +azp_tabu<- function(p, w, df, tabu_length=10, conv_tabu=10, bound_variable=data.frame(), min_bound=0, inits=0, initial_regions=vector('numeric'), scale_method="standardize", distance_method="euclidean", random_seed=123456789, rdist=numeric()) { if (p < 0) { stop("The p should be a positive integer number.") } @@ -620,15 +628,15 @@ azp_tabu<- function(p, w, df, tabu_length=10, conv_tabu=10, bound_variable=data. bound_values <- bound_variable[[1]] } - return(p_azp_tabu(p, w$GetPointer(), df, n_vars, tabu_length, conv_tabu, bound_values, min_bound, inits, initial_regions, scale_method, distance_method, random_seed)) + return(p_azp_tabu(p, w$GetPointer(), df, n_vars, tabu_length, conv_tabu, bound_values, min_bound, inits, initial_regions, scale_method, distance_method, random_seed, rdist)) } ############################################################ #' @title Spatial Validation #' @description Spatial validation provides a collection of validation measures including -#' 1. fragmentations (entropy, simpson), 2. join count ratio, 3. compactness (isoperimeter quotient) +#' 1. fragmentations (entropy, simpson), 2. join count ratio, 3. compactness (isoperimeter quotient) #' and 4. diameter. -#' @param sf_obj An sf (simple feature) object +#' @param sf_obj An sf (simple feature) object #' @param clusters A cluster classification variable (categorical values from a dataframe or values returned from cluster functions) #' @param w An instance of Weight class #' @return A list with names "Is Spatially Constrained", "Fragmentation", "Join Count Ratio", @@ -661,7 +669,7 @@ spatial_validation <- function(sf_obj, clusters, w) { ############################################################ #' @title Join Count Ratio -#' @description Join count ratio is the join counts, the number of times a category is surrounded +#' @description Join count ratio is the join counts, the number of times a category is surrounded #' by neighbors of the same category, over the total number of neighbors after converting #' each category to a dummy variable. #' @param clusters A cluster classification variable (categorical values from a dataframe or values returned from cluster functions) @@ -712,8 +720,8 @@ make_spatial <- function(clusters, w) { } if (w$num_obs != length(clusters)) { - stop("The weights doesn not match with the size of input clusters.") + stop("The weights doesn not match with the size of input clusters.") } return (p_make_spatial(clusters, w$GetPointer())); -} \ No newline at end of file +} diff --git a/README.md b/README.md index e807b460..79f7a78a 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ https://geodacenter.github.io/rgeoda/articles/rgeoda_tutorial.html https://geodacenter.github.io/rgeoda/reference/ -## Current version 0.0.8 +## Current version 0.0.9 * Map Classification * NaturalBreaks diff --git a/docs/404.html b/docs/404.html index 0643de9d..ca49ebc8 100644 --- a/docs/404.html +++ b/docs/404.html @@ -71,7 +71,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/articles/index.html b/docs/articles/index.html index c39eaccd..2842e1eb 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -71,7 +71,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/articles/rgeoda_tutorial.html b/docs/articles/rgeoda_tutorial.html index 59205815..4d2b8ea3 100644 --- a/docs/articles/rgeoda_tutorial.html +++ b/docs/articles/rgeoda_tutorial.html @@ -31,7 +31,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -76,7 +76,7 @@ -
+

@@ -114,9 +114,7 @@

 guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda")
 guerry <- st_read(guerry_path)
-
## Reading layer `Guerry' from data source 
-##   `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' 
-##   using driver `ESRI Shapefile'
+
## Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile'
 ## Simple feature collection with 85 features and 29 fields
 ## Geometry type: MULTIPOLYGON
 ## Dimension:     XY
@@ -296,14 +294,14 @@ 

 save_weights(rook_w, guerry['CODE_DE'], out_path = '/Users/xun/Downloads/Guerry_r.gal', 
              layer_name = 'Guerry')
-
## [1] FALSE
+
## [1] TRUE

3.3 Distance Based Weights

The most straightforward spatial weights matrix constructed from a distance measure is obtained when i and j are considered neighbors whenever j falls within a critical distance band from i. In order to start the distance based neighbors, we first need to compute a threshold value. rgeoda provides a function min_distthreshold to help you find a optimized distance threshold that guarantees that every observation has at least one neighbor:

- +
min_distthreshold(GeoDa gda, bool is_arc = False, is_mile = True)
+To create a Distance based weights, one can call the function `distance_weights`:

Then, with this distance threshold, we can create a distance-band weights using the function:

 distance_weights(geoda_obj, dist_thres, power=1.0,  is_inverse=False, is_arc=False, is_mile=True)
@@ -746,13 +744,15 @@

5.1 SKATER

-

The Spatial C(K)luster Analysis by Tree Edge Removal(SKATER) algorithm introduced by Assuncao et al. (2006) is based on the optimal pruning of a minimum spanning tree that reflects the contiguity structure among the observations. It provides an optimized algorithm to prune to tree into several clusters that their values of selected variables are as similar as possible.

+

The Spatial C(K)luster Analysis by Tree Edge Removal(SKATER) algorithm introduced by Assuncao et al. (2006) is based on the optimal pruning of a minimum spanning tree that reflects the contiguity structure among the observations. It provides an optimized algorithm to prune to tree into several clusters that their values of selected variables are as similar as possible.

The rgeoda’s SKATER function is:

- +
skater(k, w, data, distance_method='euclidean', bound_vals = [],  min_bound = 0, random_seed=123456789)

For example, to create 4 spatially contiguous clusters using Guerry dataset, the queen weights and the values of the 6 selected variables:

-guerry_clusters <- skater(4, queen_w, data)
-guerry_clusters
+guerry_clusters <- skater(4, queen_w, data)
+
## aaa0x0after gda_skater
+
+guerry_clusters
## $Clusters
 ##  [1] 3 2 3 1 1 1 2 1 2 1 1 1 2 1 1 3 3 3 2 4 3 1 2 1 2 2 4 1 1 1 1 1 4 3 4 1 2 1
 ## [39] 4 3 3 4 2 1 1 1 4 4 2 2 4 2 2 4 2 3 2 2 4 2 3 1 1 1 2 2 1 2 3 4 2 2 2 2 3 2
@@ -783,7 +783,7 @@ 

  • Full-order and Wards-linkage
  • For example, to find 4 clusters using the same dataset and weights as above using REDCAP with Full-order and Complete-linkage method:

    -
    +
     redcap_clusters <- redcap(4, queen_w, data, "fullorder-completelinkage")
     redcap_clusters
    ## $Clusters
    @@ -808,7 +808,7 @@ 

    5.3 Spatially Constrained Hierarchical Clucstering

    Spatially constrained hierarchical clustering is a special form of constrained clustering, where the constraint is based on contiguity (common borders). The method builds up the clusters using agglomerative hierarchical clustering methods: single linkage, complete linkage, average linkage and Ward’s method (a special form of centroid linkage). Meanwhile, it also maintains the spatial contiguity when merging two clusters.

    For example, to find 4 spatially constrained clusters using the same dataset and weights as above using Complete-linkage method:

    -
    +
     schc_clusters <- schc(4, queen_w, data, "complete")
     schc_clusters
    ## $Clusters
    @@ -842,7 +842,7 @@ 

    5.4.1 AZP greedy

    The original AZP heuristic is a local optimization procedure that cycles through a series of possible swaps between spatial units at the boundary of a set of regions. The process starts with an initial feasible solution, i.e., a grouping of n spatial units into p contiguous regions. This initial solution can be constructed in several different ways. The initial solution must satisfy the contiguity constraints. For example, this can be accomplished by growing a set of contiguous regions from p randomly selected seed units by adding neighboring locations until the contiguity constraint can no longer be met.

    -
    +
     azp_clusters <- azp_greedy(5, queen_w, data)
     azp_clusters
    ## $Clusters
    @@ -866,7 +866,7 @@ 

    5.4.2 AZP Simulated Annealing

    To call AZP simulate annealing algorithm, one needs to specify cooling_rate (default: 0.85):

    -
    +
     azp_clusters <- azp_sa(5, queen_w, data, cooling_rate = 0.85)
     azp_clusters
    ## $Clusters
    @@ -890,7 +890,7 @@ 

    5.4.3 AZP Tabu Search

    To call AZP Tabu search algorithm, one needs to specify tabu_length (deafult: 10) , or conv_tabu (default: 10):

    -
    +
     azp_clusters <- azp_tabu(5, queen_w, data, tabu_length = 10, conv_tabu = 10)
     azp_clusters
    ## $Clusters
    @@ -929,11 +929,11 @@ 

    5.5.1 Max-p greedy

    For example, to use the greedy algorithm in maxp function with the same dataset and weights as above to find optimal clusters using max-p:

    First, we need to specify, for example, every cluster must have population >= 3236.67 thousand people:

    -
    +
     bound_vals <- guerry['Pop1831']
     min_bound <- 3236.67 # 10% of Pop1831

    Then, we can call the max-p function with the “greedy” algorithm, the bound values, and minimum bound value:

    -
    +
     maxp_clusters <- maxp_greedy(queen_w, data, bound_vals, min_bound)
     maxp_clusters
    ## $Clusters
    @@ -960,7 +960,7 @@ 

    5.5.2 Max-p Tabu Search

    To use tabu search algorithm in maxp function, we can specify the parameters of tabu_length and conv_tabu:

    -
    +
     maxp_tabu_clusters <- maxp_tabu(queen_w, data, bound_vals, min_bound, tabu_length=10, conv_tabu=10)
     maxp_tabu_clusters
    ## $Clusters
    @@ -984,7 +984,7 @@ 

    5.5.3 Max-p Simulated Annealing

    To apply simulated annealing algorithm in maxp function with the parameter of cooling rate:

    -
    +
     maxp_sa_clusters <- maxp_sa(queen_w, data, bound_vals, min_bound, cooling_rate=0.85, sa_maxit=1)
     maxp_sa_clusters
    ## $Clusters
    @@ -1004,7 +1004,7 @@ 

    ## $`The ratio of between to total sum of squares` ## [1] 0.4585352

    We can also increase the number of iterations for local search process by specifying the parameter iterations (default value is 99):

    -
    +
     maxp_clusters <- maxp_greedy(queen_w, data, bound_vals, min_bound, iterations=199)
     maxp_clusters
    ## $Clusters
    @@ -1035,7 +1035,7 @@ 

    6.1 Start from sf package

    The sf package has been popular tool to handle geospatial data. It is a good substitue of sp package which will be deprecated soon.

    For example, we can simply call plot() function to render the first 9 chorepleth maps using the frist 9 variables in the dataset:

    -
    +
     plot(guerry)
    ## Warning: plotting the first 9 out of 30 attributes; use max.plot = 30 to plot
     ## all
    @@ -1045,7 +1045,7 @@

    6.2 ESDA with rgeoda

    Now, with the sf object guerry, you can call rgeoda’s spatial analysis functions. For example, to examine the local Moran statistics of variable “crm_prs” (Population per Crime against persons):

    -
    +
     queen_w <- queen_weights(guerry)
     lisa <- local_moran(queen_w,  guerry['Crm_prs'])

    Note: rgeoda uses wkb, which is a binary representation of geometries, to exchange data between sf and libgeoda in memory.

    @@ -1054,7 +1054,7 @@

    6.3 Create Local Moran Map

    With the LISA results, we can make a local moran cluster map:

    -
    +
     lisa_colors <- lisa_colors(lisa)
     lisa_labels <- lisa_labels(lisa)
     lisa_clusters <- lisa_clusters(lisa)
    @@ -1066,16 +1066,16 @@ 

    legend('bottomleft', legend = lisa_labels, fill = lisa_colors, border = "#eeeeee")

    In the above code, we use th values of cluster indicators from rgeoda’s LISA object are used to make the LISA map. We can save the clusters back to the original sf data.frame:

    -
    +
     guerry['moran_cluster'] <- lisa_clusters

    Checking the values of the cluster indicators, we will see they are integer numbers 0 (not significant), 1 (high-high cluster), 2 (low-low cluster), 3 (low-high cluster), 4 (high-low cluster), 5 (neighborless/island), 6 (undefined):

    -
    +
     lisa_clusters
    ##  [1] 0 1 1 0 0 2 0 2 0 2 2 0 0 2 0 0 1 0 0 0 0 0 0 2 0 0 0 2 2 0 0 2 1 0 3 0 0 0
     ## [39] 0 0 0 0 0 0 0 2 0 0 3 0 1 0 0 0 0 0 1 0 0 1 0 0 0 2 0 0 0 0 1 1 0 0 0 0 0 0
     ## [77] 2 2 0 2 0 0 0 0 0

    To create a significance map that is associated with the local Moran map, we can do the same as making the local moran cluster map using the results from lisa_pvalues():

    -
    +
     lisa_p <- lisa_pvalues(lisa)
     p_labels <- c("Not significant", "p <= 0.05", "p <= 0.01", "p <= 0.001")
     p_colors <- c("#eeeeee", "#84f576", "#53c53c", "#348124")
    diff --git a/docs/articles/rgeoda_tutorial_files/figure-html/unnamed-chunk-62-1.png b/docs/articles/rgeoda_tutorial_files/figure-html/unnamed-chunk-62-1.png
    index 816ab4fd..2cb0b1c9 100644
    Binary files a/docs/articles/rgeoda_tutorial_files/figure-html/unnamed-chunk-62-1.png and b/docs/articles/rgeoda_tutorial_files/figure-html/unnamed-chunk-62-1.png differ
    diff --git a/docs/articles/rgeoda_tutorial_files/figure-html/unnamed-chunk-64-1.png b/docs/articles/rgeoda_tutorial_files/figure-html/unnamed-chunk-64-1.png
    index 83f2ac40..f2aedb9c 100644
    Binary files a/docs/articles/rgeoda_tutorial_files/figure-html/unnamed-chunk-64-1.png and b/docs/articles/rgeoda_tutorial_files/figure-html/unnamed-chunk-64-1.png differ
    diff --git a/docs/articles/rgeoda_tutorial_files/figure-html/unnamed-chunk-67-1.png b/docs/articles/rgeoda_tutorial_files/figure-html/unnamed-chunk-67-1.png
    index 09e6aa8c..dda8a91c 100644
    Binary files a/docs/articles/rgeoda_tutorial_files/figure-html/unnamed-chunk-67-1.png and b/docs/articles/rgeoda_tutorial_files/figure-html/unnamed-chunk-67-1.png differ
    diff --git a/docs/authors.html b/docs/authors.html
    index 8a9b6ece..7a70ffd2 100644
    --- a/docs/authors.html
    +++ b/docs/authors.html
    @@ -71,7 +71,7 @@
           
           
             rgeoda
    -        0.0.8-6
    +        0.0.9
           
         
    diff --git a/docs/index.html b/docs/index.html index 0de0915b..b64f2571 100644 --- a/docs/index.html +++ b/docs/index.html @@ -34,7 +34,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -118,9 +118,9 @@

    https://geodacenter.github.io/rgeoda/reference/

    -
    +

    -Current version 0.0.8

    +Current version 0.0.9

    • Map Classification
        @@ -192,6 +192,16 @@

      • Simulated Annealing
    • +
    • Join Count Ratio
    • +
    • Spatial Validation +
        +
      • Fragmentation
      • +
      • Join Count Ratio
      • +
      • Compactness
      • +
      • Diameter
      • +
      +
    • +
    • Make Spatial
    @@ -201,7 +211,7 @@

    Build and install from source code

    In R console, one can use devtools to install rgeoda from its source package:

    -devtools::install_github("geodacenter/rgeoda")
    +devtools::install_github("geodacenter/rgeoda")

    Mac

    diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index d2540240..61855303 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,7 +1,7 @@ -pandoc: 2.3.1 +pandoc: 2.11.4 pkgdown: 1.6.1 pkgdown_sha: ~ articles: rgeoda_tutorial: rgeoda_tutorial.html -last_built: 2021-09-07T23:07Z +last_built: 2022-04-05T04:38Z diff --git a/docs/reference/LISA-class.html b/docs/reference/LISA-class.html index 86f7af21..238ee000 100644 --- a/docs/reference/LISA-class.html +++ b/docs/reference/LISA-class.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/Weight-class.html b/docs/reference/Weight-class.html index 245a91f3..2b7c12ed 100644 --- a/docs/reference/Weight-class.html +++ b/docs/reference/Weight-class.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/as.data.frame.geoda.html b/docs/reference/as.data.frame.geoda.html index cc819fa5..92489429 100644 --- a/docs/reference/as.data.frame.geoda.html +++ b/docs/reference/as.data.frame.geoda.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/as.geoda.html b/docs/reference/as.geoda.html index 16d6a39f..8f75a91f 100644 --- a/docs/reference/as.geoda.html +++ b/docs/reference/as.geoda.html @@ -75,7 +75,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/as.matrix.Weight.html b/docs/reference/as.matrix.Weight.html index dff84795..d86d8bdb 100644 --- a/docs/reference/as.matrix.Weight.html +++ b/docs/reference/as.matrix.Weight.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/azp_greedy.html b/docs/reference/azp_greedy.html index 5d4370a0..8b1473eb 100644 --- a/docs/reference/azp_greedy.html +++ b/docs/reference/azp_greedy.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -139,7 +139,8 @@

    A greedy algorithm to solve the AZP problem

    initial_regions = vector("numeric"), scale_method = "standardize", distance_method = "euclidean", - random_seed = 123456789 + random_seed = 123456789, + rdist = numeric() )

    Arguments

    @@ -185,6 +186,10 @@

    Arg random_seed

    (optional) The seed for random number generator. Defaults to 123456789.

    + + rdist +

    (optional) The distance matrix (lower triangular matrix, column wise storage)

    +

    Value

    diff --git a/docs/reference/azp_sa.html b/docs/reference/azp_sa.html index d704904b..220cec27 100644 --- a/docs/reference/azp_sa.html +++ b/docs/reference/azp_sa.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -141,7 +141,8 @@

    A simulated annealing algorithm to solve the AZP problem

    initial_regions = vector("numeric"), scale_method = "standardize", distance_method = "euclidean", - random_seed = 123456789 + random_seed = 123456789, + rdist = numeric() )

    Arguments

    @@ -195,6 +196,10 @@

    Arg random_seed

    (optional) The seed for random number generator. Defaults to 123456789.

    + + rdist +

    (optional) The distance matrix (lower triangular matrix, column wise storage)

    +

    Value

    diff --git a/docs/reference/azp_tabu.html b/docs/reference/azp_tabu.html index 18b4ed94..333753cd 100644 --- a/docs/reference/azp_tabu.html +++ b/docs/reference/azp_tabu.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -141,7 +141,8 @@

    A tabu algorithm to solve the AZP problem

    initial_regions = vector("numeric"), scale_method = "standardize", distance_method = "euclidean", - random_seed = 123456789 + random_seed = 123456789, + rdist = numeric() )

    Arguments

    @@ -195,6 +196,10 @@

    Arg random_seed

    (optional) The seed for random number generator. Defaults to 123456789.

    + + rdist +

    (optional) The distance matrix (lower triangular matrix, column wise storage)

    +

    Value

    diff --git a/docs/reference/create_weights.html b/docs/reference/create_weights.html index 5e86c6b5..f81fd3b5 100644 --- a/docs/reference/create_weights.html +++ b/docs/reference/create_weights.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/distance_weights.html b/docs/reference/distance_weights.html index 13f86f96..7d6e3834 100644 --- a/docs/reference/distance_weights.html +++ b/docs/reference/distance_weights.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -177,11 +177,9 @@

    Value

    Examples

    #> Linking to GEOS 3.8.1, GDAL 3.2.1, PROJ 7.2.1
    guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") +
    #> Linking to GEOS 3.9.1, GDAL 3.2.3, PROJ 7.2.1
    guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/eb_rates.html b/docs/reference/eb_rates.html index 5d59b318..c8384786 100644 --- a/docs/reference/eb_rates.html +++ b/docs/reference/eb_rates.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/gda_distance_weights.html b/docs/reference/gda_distance_weights.html index 60bc3fb7..ce31981f 100644 --- a/docs/reference/gda_distance_weights.html +++ b/docs/reference/gda_distance_weights.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/gda_kernel_knn_weights.html b/docs/reference/gda_kernel_knn_weights.html index f5dfd050..1bc13e17 100644 --- a/docs/reference/gda_kernel_knn_weights.html +++ b/docs/reference/gda_kernel_knn_weights.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/gda_kernel_weights.html b/docs/reference/gda_kernel_weights.html index 1077f7e6..949e9713 100644 --- a/docs/reference/gda_kernel_weights.html +++ b/docs/reference/gda_kernel_weights.html @@ -75,7 +75,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/gda_knn_weights.html b/docs/reference/gda_knn_weights.html index cf0b3486..8d15770f 100644 --- a/docs/reference/gda_knn_weights.html +++ b/docs/reference/gda_knn_weights.html @@ -74,7 +74,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/gda_min_distthreshold.html b/docs/reference/gda_min_distthreshold.html index 41a88597..9e593602 100644 --- a/docs/reference/gda_min_distthreshold.html +++ b/docs/reference/gda_min_distthreshold.html @@ -75,7 +75,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/gda_queen_weights.html b/docs/reference/gda_queen_weights.html index 83f57d11..95306669 100644 --- a/docs/reference/gda_queen_weights.html +++ b/docs/reference/gda_queen_weights.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/gda_rook_weights.html b/docs/reference/gda_rook_weights.html index f0bb5486..692191c7 100644 --- a/docs/reference/gda_rook_weights.html +++ b/docs/reference/gda_rook_weights.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/geoda-class.html b/docs/reference/geoda-class.html index d57ca308..e568dc40 100644 --- a/docs/reference/geoda-class.html +++ b/docs/reference/geoda-class.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/geoda_open.html b/docs/reference/geoda_open.html index dbcfc86d..cc126aaf 100644 --- a/docs/reference/geoda_open.html +++ b/docs/reference/geoda_open.html @@ -75,7 +75,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/get_neighbors.html b/docs/reference/get_neighbors.html index fac74cc8..6e6d9afc 100644 --- a/docs/reference/get_neighbors.html +++ b/docs/reference/get_neighbors.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/get_neighbors_weights.html b/docs/reference/get_neighbors_weights.html index b7116a7c..17d6c2b1 100644 --- a/docs/reference/get_neighbors_weights.html +++ b/docs/reference/get_neighbors_weights.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/has_isolates.html b/docs/reference/has_isolates.html index ad22dfc0..a31d4b83 100644 --- a/docs/reference/has_isolates.html +++ b/docs/reference/has_isolates.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/hinge15_breaks.html b/docs/reference/hinge15_breaks.html index 151d8ac2..ff15838c 100644 --- a/docs/reference/hinge15_breaks.html +++ b/docs/reference/hinge15_breaks.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -150,9 +150,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/hinge30_breaks.html b/docs/reference/hinge30_breaks.html index 64a52333..c0a249e2 100644 --- a/docs/reference/hinge30_breaks.html +++ b/docs/reference/hinge30_breaks.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -150,9 +150,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/index.html b/docs/reference/index.html index ec1184af..5878168d 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -71,7 +71,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/is_symmetric.html b/docs/reference/is_symmetric.html index 1633a748..45b2680c 100644 --- a/docs/reference/is_symmetric.html +++ b/docs/reference/is_symmetric.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/join_count_ratio.html b/docs/reference/join_count_ratio.html index 3f699b31..a7ef370b 100644 --- a/docs/reference/join_count_ratio.html +++ b/docs/reference/join_count_ratio.html @@ -40,7 +40,7 @@ - @@ -74,7 +74,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -128,7 +128,7 @@

    Join Count Ratio

    -

    Join count ratio is the join counts, the number of times a category is surrounded +

    Join count ratio is the join counts, the number of times a category is surrounded by neighbors of the same category, over the total number of neighbors after converting each category to a dummy variable.

    diff --git a/docs/reference/kernel_knn_weights.html b/docs/reference/kernel_knn_weights.html index eab200bf..7d180a43 100644 --- a/docs/reference/kernel_knn_weights.html +++ b/docs/reference/kernel_knn_weights.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -200,9 +200,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/kernel_weights.html b/docs/reference/kernel_weights.html index eb9d3df1..a3145690 100644 --- a/docs/reference/kernel_weights.html +++ b/docs/reference/kernel_weights.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -193,9 +193,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/knn_weights.html b/docs/reference/knn_weights.html index ad51901c..136ec8e7 100644 --- a/docs/reference/knn_weights.html +++ b/docs/reference/knn_weights.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -179,9 +179,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/lisa_bo.html b/docs/reference/lisa_bo.html index 64f57f5e..6a5ac816 100644 --- a/docs/reference/lisa_bo.html +++ b/docs/reference/lisa_bo.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/lisa_clusters.html b/docs/reference/lisa_clusters.html index 04c34127..a5cf1d32 100644 --- a/docs/reference/lisa_clusters.html +++ b/docs/reference/lisa_clusters.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/lisa_colors.html b/docs/reference/lisa_colors.html index 97c3e0b3..713fdd1f 100644 --- a/docs/reference/lisa_colors.html +++ b/docs/reference/lisa_colors.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/lisa_fdr.html b/docs/reference/lisa_fdr.html index 2ddaf7fa..b09e2c21 100644 --- a/docs/reference/lisa_fdr.html +++ b/docs/reference/lisa_fdr.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/lisa_labels.html b/docs/reference/lisa_labels.html index f2384c48..a32bc955 100644 --- a/docs/reference/lisa_labels.html +++ b/docs/reference/lisa_labels.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/lisa_num_nbrs.html b/docs/reference/lisa_num_nbrs.html index 54fec726..2eb113be 100644 --- a/docs/reference/lisa_num_nbrs.html +++ b/docs/reference/lisa_num_nbrs.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/lisa_pvalues.html b/docs/reference/lisa_pvalues.html index 5b057659..0bd6fa48 100644 --- a/docs/reference/lisa_pvalues.html +++ b/docs/reference/lisa_pvalues.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/lisa_values.html b/docs/reference/lisa_values.html index efa6fdb8..88be7f94 100644 --- a/docs/reference/lisa_values.html +++ b/docs/reference/lisa_values.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/local_bijoincount.html b/docs/reference/local_bijoincount.html index 5c330180..5ef950f1 100644 --- a/docs/reference/local_bijoincount.html +++ b/docs/reference/local_bijoincount.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -185,9 +185,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/local_bimoran.html b/docs/reference/local_bimoran.html index 30353127..9293773e 100644 --- a/docs/reference/local_bimoran.html +++ b/docs/reference/local_bimoran.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -184,9 +184,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/local_g.html b/docs/reference/local_g.html index 4333fb0b..6d94472b 100644 --- a/docs/reference/local_g.html +++ b/docs/reference/local_g.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -184,9 +184,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/local_geary.html b/docs/reference/local_geary.html index 0b59c6a8..59836515 100644 --- a/docs/reference/local_geary.html +++ b/docs/reference/local_geary.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -184,9 +184,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/local_gstar.html b/docs/reference/local_gstar.html index a13dd667..c39e2974 100644 --- a/docs/reference/local_gstar.html +++ b/docs/reference/local_gstar.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -184,9 +184,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/local_joincount.html b/docs/reference/local_joincount.html index 9e99801f..64fb09d5 100644 --- a/docs/reference/local_joincount.html +++ b/docs/reference/local_joincount.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -184,9 +184,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/local_moran.html b/docs/reference/local_moran.html index 5bdf8be1..f546f4d9 100644 --- a/docs/reference/local_moran.html +++ b/docs/reference/local_moran.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -184,9 +184,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/local_moran_eb.html b/docs/reference/local_moran_eb.html index 45b0b27b..97bcbd33 100644 --- a/docs/reference/local_moran_eb.html +++ b/docs/reference/local_moran_eb.html @@ -74,7 +74,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/local_multigeary.html b/docs/reference/local_multigeary.html index 98b4a7e8..e9e918b9 100644 --- a/docs/reference/local_multigeary.html +++ b/docs/reference/local_multigeary.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -184,9 +184,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/local_multijoincount.html b/docs/reference/local_multijoincount.html index fedd945f..3ad112f7 100644 --- a/docs/reference/local_multijoincount.html +++ b/docs/reference/local_multijoincount.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -187,9 +187,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/local_multiquantilelisa.html b/docs/reference/local_multiquantilelisa.html index 64b97be0..487b4639 100644 --- a/docs/reference/local_multiquantilelisa.html +++ b/docs/reference/local_multiquantilelisa.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -197,9 +197,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/local_quantilelisa.html b/docs/reference/local_quantilelisa.html index ba531119..66c4b549 100644 --- a/docs/reference/local_quantilelisa.html +++ b/docs/reference/local_quantilelisa.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -195,9 +195,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/make_spatial.html b/docs/reference/make_spatial.html index bb492b6d..0f6f04db 100644 --- a/docs/reference/make_spatial.html +++ b/docs/reference/make_spatial.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/max_neighbors.html b/docs/reference/max_neighbors.html index 52539ac5..f3658b31 100644 --- a/docs/reference/max_neighbors.html +++ b/docs/reference/max_neighbors.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/maxp_greedy.html b/docs/reference/maxp_greedy.html index 5cfdcd89..3b55d7e4 100644 --- a/docs/reference/maxp_greedy.html +++ b/docs/reference/maxp_greedy.html @@ -75,7 +75,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -145,7 +145,8 @@

    A greedy algorithm to solve the max-p-region problem

    scale_method = "standardize", distance_method = "euclidean", random_seed = 123456789, - cpu_threads = 6 + cpu_threads = 6, + rdist = numeric() )

    Arguments

    @@ -191,6 +192,10 @@

    Arg cpu_threads

    (optional) The number of cpu threads used for parallel computation

    + + rdist +

    (optional) The distance matrix (lower triangular matrix, column wise storage)

    +

    Value

    diff --git a/docs/reference/maxp_sa.html b/docs/reference/maxp_sa.html index f74d3bec..c68ebd75 100644 --- a/docs/reference/maxp_sa.html +++ b/docs/reference/maxp_sa.html @@ -75,7 +75,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -147,7 +147,8 @@

    A simulated annealing algorithm to solve the max-p-region problem

    scale_method = "standardize", distance_method = "euclidean", random_seed = 123456789, - cpu_threads = 6 + cpu_threads = 6, + rdist = numeric() )

    Arguments

    @@ -201,6 +202,10 @@

    Arg cpu_threads

    (optional) The number of cpu threads used for parallel computation

    + + rdist +

    (optional) The distance matrix (lower triangular matrix, column wise storage)

    +

    Value

    diff --git a/docs/reference/maxp_tabu.html b/docs/reference/maxp_tabu.html index a5459d1d..d9691c61 100644 --- a/docs/reference/maxp_tabu.html +++ b/docs/reference/maxp_tabu.html @@ -75,7 +75,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -147,7 +147,8 @@

    A tabu-search algorithm to solve the max-p-region problem

    scale_method = "standardize", distance_method = "euclidean", random_seed = 123456789, - cpu_threads = 6 + cpu_threads = 6, + rdist = numeric() )

    Arguments

    @@ -201,6 +202,10 @@

    Arg cpu_threads

    (optional) The number of cpu threads used for parallel computation

    + + rdist +

    (optional) The distance matrix (lower triangular matrix, column wise storage)

    +

    Value

    diff --git a/docs/reference/mean_neighbors.html b/docs/reference/mean_neighbors.html index 2b20cab3..2b59d3fe 100644 --- a/docs/reference/mean_neighbors.html +++ b/docs/reference/mean_neighbors.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/median_neighbors.html b/docs/reference/median_neighbors.html index 5ee143ef..1ada1133 100644 --- a/docs/reference/median_neighbors.html +++ b/docs/reference/median_neighbors.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/min_distthreshold.html b/docs/reference/min_distthreshold.html index 7b5f2afe..05caf5dd 100644 --- a/docs/reference/min_distthreshold.html +++ b/docs/reference/min_distthreshold.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/min_neighbors.html b/docs/reference/min_neighbors.html index 2e219c09..fbc6701a 100644 --- a/docs/reference/min_neighbors.html +++ b/docs/reference/min_neighbors.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/natural_breaks.html b/docs/reference/natural_breaks.html index baa24597..3fc0b2d6 100644 --- a/docs/reference/natural_breaks.html +++ b/docs/reference/natural_breaks.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -154,9 +154,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/neighbor_match_test.html b/docs/reference/neighbor_match_test.html index 0d358d64..b0028044 100644 --- a/docs/reference/neighbor_match_test.html +++ b/docs/reference/neighbor_match_test.html @@ -74,7 +74,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -197,9 +197,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/p_GeoDa-class.html b/docs/reference/p_GeoDa-class.html index d3271ad5..6f12a076 100644 --- a/docs/reference/p_GeoDa-class.html +++ b/docs/reference/p_GeoDa-class.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/p_GeoDaTable-class.html b/docs/reference/p_GeoDaTable-class.html index 0b477351..0f50e273 100644 --- a/docs/reference/p_GeoDaTable-class.html +++ b/docs/reference/p_GeoDaTable-class.html @@ -74,7 +74,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/p_GeoDaWeight-class.html b/docs/reference/p_GeoDaWeight-class.html index 9556beb7..45c64d59 100644 --- a/docs/reference/p_GeoDaWeight-class.html +++ b/docs/reference/p_GeoDaWeight-class.html @@ -74,7 +74,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/p_LISA-class.html b/docs/reference/p_LISA-class.html index dd045009..8c76ed3b 100644 --- a/docs/reference/p_LISA-class.html +++ b/docs/reference/p_LISA-class.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/percentile_breaks.html b/docs/reference/percentile_breaks.html index 1749b0ac..83231dae 100644 --- a/docs/reference/percentile_breaks.html +++ b/docs/reference/percentile_breaks.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -150,9 +150,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/quantile_breaks.html b/docs/reference/quantile_breaks.html index 552e447b..8873bbb6 100644 --- a/docs/reference/quantile_breaks.html +++ b/docs/reference/quantile_breaks.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -154,9 +154,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/queen_weights.html b/docs/reference/queen_weights.html index aba51ea0..94a32779 100644 --- a/docs/reference/queen_weights.html +++ b/docs/reference/queen_weights.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    @@ -170,9 +170,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/read_gal.html b/docs/reference/read_gal.html index 4cf38480..90ec5958 100644 --- a/docs/reference/read_gal.html +++ b/docs/reference/read_gal.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/read_gwt.html b/docs/reference/read_gwt.html index 9e48e295..0ceeefa4 100644 --- a/docs/reference/read_gwt.html +++ b/docs/reference/read_gwt.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/read_swm.html b/docs/reference/read_swm.html index 7d191664..1104b449 100644 --- a/docs/reference/read_swm.html +++ b/docs/reference/read_swm.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/redcap.html b/docs/reference/redcap.html index 83a138ba..fb5a5a49 100644 --- a/docs/reference/redcap.html +++ b/docs/reference/redcap.html @@ -83,7 +83,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -161,7 +161,8 @@

    Regionalization with dynamically constrained agglomerative clustering and pa scale_method = "standardize", distance_method = "euclidean", random_seed = 123456789, - cpu_threads = 6 + cpu_threads = 6, + rdist = numeric() )

    Arguments

    @@ -207,6 +208,10 @@

    Arg cpu_threads

    (optional) The number of cpu threads used for parallel computation

    + + rdist +

    (optional) The distance matrix (lower triangular matrix, column wise storage)

    +

    Value

    diff --git a/docs/reference/rook_weights.html b/docs/reference/rook_weights.html index a14b51a4..f1cc0f33 100644 --- a/docs/reference/rook_weights.html +++ b/docs/reference/rook_weights.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -170,9 +170,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/save_weights.html b/docs/reference/save_weights.html index f4c16688..7f324246 100644 --- a/docs/reference/save_weights.html +++ b/docs/reference/save_weights.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/schc.html b/docs/reference/schc.html index eb6e8795..03811d61 100644 --- a/docs/reference/schc.html +++ b/docs/reference/schc.html @@ -75,7 +75,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -143,7 +143,8 @@

    Spatially Constrained Hierarchical Clucstering (SCHC)

    bound_variable = data.frame(), min_bound = 0, scale_method = "standardize", - distance_method = "euclidean" + distance_method = "euclidean", + rdist = numeric() )

    Arguments

    @@ -181,6 +182,10 @@

    Arg distance_method

    (optional) The distance method used to compute the distance betwen observation i and j. Defaults to "euclidean". Options are "euclidean" and "manhattan"

    + + rdist +

    (optional) The distance matrix (lower triangular matrix, column wise storage)

    +

    Value

    @@ -191,9 +196,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/set_neighbors.html b/docs/reference/set_neighbors.html index e0b26e9a..0fc616c8 100644 --- a/docs/reference/set_neighbors.html +++ b/docs/reference/set_neighbors.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/set_neighbors_with_weights.html b/docs/reference/set_neighbors_with_weights.html index bebf2278..ee4b6c21 100644 --- a/docs/reference/set_neighbors_with_weights.html +++ b/docs/reference/set_neighbors_with_weights.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/sf_to_geoda.html b/docs/reference/sf_to_geoda.html index 4524a07e..5a94479a 100644 --- a/docs/reference/sf_to_geoda.html +++ b/docs/reference/sf_to_geoda.html @@ -74,7 +74,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/skater.html b/docs/reference/skater.html index 112b0bac..7e4117d2 100644 --- a/docs/reference/skater.html +++ b/docs/reference/skater.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -140,7 +140,8 @@

    Spatial C(K)luster Analysis by Tree Edge Removal

    scale_method = "standardize", distance_method = "euclidean", random_seed = 123456789, - cpu_threads = 6 + cpu_threads = 6, + rdist = numeric() )

    Arguments

    @@ -182,20 +183,21 @@

    Arg cpu_threads

    (optional) The number of cpu threads used for parallel computation

    + + rdist +

    (optional) The distance matrix (lower triangular matrix, column wise storage)

    +

    Value

    -

    A list of numeric vectors represents a group of clusters

    -

    A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares".

    +

    A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares".

    Examples

    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY @@ -203,7 +205,7 @@

    Examp #> Projected CRS: NTF (Paris) / Lambert zone II

    queen_w <- queen_weights(guerry) data <- guerry[c('Crm_prs','Crm_prp','Litercy','Donatns','Infants','Suicids')] guerry_clusters <- skater(4, queen_w, data) -guerry_clusters +
    #> aaa0x0after gda_skater
    guerry_clusters
    #> $Clusters #> [1] 3 2 3 1 1 1 2 1 2 1 1 1 2 1 1 3 3 3 2 4 3 1 2 1 2 2 4 1 1 1 1 1 4 3 4 1 2 1 #> [39] 4 3 3 4 2 1 1 1 4 4 2 2 4 2 2 4 2 3 2 2 4 2 3 1 1 1 2 2 1 2 3 4 2 2 2 2 3 2 diff --git a/docs/reference/sp_to_geoda.html b/docs/reference/sp_to_geoda.html index 99156ab0..26128dbe 100644 --- a/docs/reference/sp_to_geoda.html +++ b/docs/reference/sp_to_geoda.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/spatial_lag.html b/docs/reference/spatial_lag.html index 246f93d2..a2b7e62d 100644 --- a/docs/reference/spatial_lag.html +++ b/docs/reference/spatial_lag.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/spatial_validation.html b/docs/reference/spatial_validation.html index 67c86cc0..04b9dc23 100644 --- a/docs/reference/spatial_validation.html +++ b/docs/reference/spatial_validation.html @@ -41,7 +41,7 @@ @@ -74,7 +74,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -129,7 +129,7 @@

    Spatial Validation

    Spatial validation provides a collection of validation measures including -1. fragmentations (entropy, simpson), 2. join count ratio, 3. compactness (isoperimeter quotient) +1. fragmentations (entropy, simpson), 2. join count ratio, 3. compactness (isoperimeter quotient) and 4. diameter.

    diff --git a/docs/reference/stddev_breaks.html b/docs/reference/stddev_breaks.html index 88ccb1a2..fc52c604 100644 --- a/docs/reference/stddev_breaks.html +++ b/docs/reference/stddev_breaks.html @@ -74,7 +74,7 @@ rgeoda - 0.0.8-6 + 0.0.9 @@ -152,9 +152,7 @@

    Examp
    library(sf) guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- st_read(guerry_path) -
    #> Reading layer `Guerry' from data source -#> `/private/var/folders/v5/tcgvkld90l3921n755r7p25h0000gq/T/RtmpCbxwFw/temp_libpath229d5718c5a/rgeoda/extdata/Guerry.shp' -#> using driver `ESRI Shapefile' +
    #> Reading layer `Guerry' from data source `/private/var/folders/z1/5l2c5r6d41bfkrlq6s66s2gh0000gn/T/RtmpU8zpfn/temp_libpath12a3d5c4022d1/rgeoda/extdata/Guerry.shp' using driver `ESRI Shapefile' #> Simple feature collection with 85 features and 29 fields #> Geometry type: MULTIPOLYGON #> Dimension: XY diff --git a/docs/reference/summary.Weight.html b/docs/reference/summary.Weight.html index 0678d2ad..96c8915b 100644 --- a/docs/reference/summary.Weight.html +++ b/docs/reference/summary.Weight.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9
    diff --git a/docs/reference/update_weights.html b/docs/reference/update_weights.html index 4582f265..f918ed78 100644 --- a/docs/reference/update_weights.html +++ b/docs/reference/update_weights.html @@ -73,7 +73,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/docs/reference/weights_sparsity.html b/docs/reference/weights_sparsity.html index 56a4a54f..a34dc205 100644 --- a/docs/reference/weights_sparsity.html +++ b/docs/reference/weights_sparsity.html @@ -72,7 +72,7 @@ rgeoda - 0.0.8-6 + 0.0.9 diff --git a/man/azp_greedy.Rd b/man/azp_greedy.Rd index d35ccb99..35b4b94c 100644 --- a/man/azp_greedy.Rd +++ b/man/azp_greedy.Rd @@ -14,7 +14,8 @@ azp_greedy( initial_regions = vector("numeric"), scale_method = "standardize", distance_method = "euclidean", - random_seed = 123456789 + random_seed = 123456789, + rdist = numeric() ) } \arguments{ @@ -37,6 +38,8 @@ azp_greedy( \item{distance_method}{(optional) The distance method used to compute the distance betwen observation i and j. Defaults to "euclidean". Options are "euclidean" and "manhattan"} \item{random_seed}{(optional) The seed for random number generator. Defaults to 123456789.} + +\item{rdist}{(optional) The distance matrix (lower triangular matrix, column wise storage)} } \value{ A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". diff --git a/man/azp_sa.Rd b/man/azp_sa.Rd index c3a4b62b..e8c2db4a 100644 --- a/man/azp_sa.Rd +++ b/man/azp_sa.Rd @@ -16,7 +16,8 @@ azp_sa( initial_regions = vector("numeric"), scale_method = "standardize", distance_method = "euclidean", - random_seed = 123456789 + random_seed = 123456789, + rdist = numeric() ) } \arguments{ @@ -43,6 +44,8 @@ azp_sa( \item{distance_method}{(optional) The distance method used to compute the distance betwen observation i and j. Defaults to "euclidean". Options are "euclidean" and "manhattan"} \item{random_seed}{(optional) The seed for random number generator. Defaults to 123456789.} + +\item{rdist}{(optional) The distance matrix (lower triangular matrix, column wise storage)} } \value{ A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". diff --git a/man/azp_tabu.Rd b/man/azp_tabu.Rd index e26d59fb..c6be9de1 100644 --- a/man/azp_tabu.Rd +++ b/man/azp_tabu.Rd @@ -16,7 +16,8 @@ azp_tabu( initial_regions = vector("numeric"), scale_method = "standardize", distance_method = "euclidean", - random_seed = 123456789 + random_seed = 123456789, + rdist = numeric() ) } \arguments{ @@ -43,6 +44,8 @@ azp_tabu( \item{distance_method}{(optional) The distance method used to compute the distance betwen observation i and j. Defaults to "euclidean". Options are "euclidean" and "manhattan"} \item{random_seed}{(optional) The seed for random number generator. Defaults to 123456789.} + +\item{rdist}{(optional) The distance matrix (lower triangular matrix, column wise storage)} } \value{ A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". diff --git a/man/join_count_ratio.Rd b/man/join_count_ratio.Rd index 87fe0eb9..a78b8bd0 100644 --- a/man/join_count_ratio.Rd +++ b/man/join_count_ratio.Rd @@ -15,7 +15,7 @@ join_count_ratio(clusters, w) A data.frame with names "Cluster", "N", "Neighbors", "Join Count", "Ratio" } \description{ -Join count ratio is the join counts, the number of times a category is surrounded +Join count ratio is the join counts, the number of times a category is surrounded by neighbors of the same category, over the total number of neighbors after converting each category to a dummy variable. } diff --git a/man/maxp_greedy.Rd b/man/maxp_greedy.Rd index aad1df5d..98a83e9c 100644 --- a/man/maxp_greedy.Rd +++ b/man/maxp_greedy.Rd @@ -14,7 +14,8 @@ maxp_greedy( scale_method = "standardize", distance_method = "euclidean", random_seed = 123456789, - cpu_threads = 6 + cpu_threads = 6, + rdist = numeric() ) } \arguments{ @@ -37,6 +38,8 @@ maxp_greedy( \item{random_seed}{(optional) The seed for random number generator. Defaults to 123456789.} \item{cpu_threads}{(optional) The number of cpu threads used for parallel computation} + +\item{rdist}{(optional) The distance matrix (lower triangular matrix, column wise storage)} } \value{ A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". diff --git a/man/maxp_sa.Rd b/man/maxp_sa.Rd index ffd41d5c..a37bbcc0 100644 --- a/man/maxp_sa.Rd +++ b/man/maxp_sa.Rd @@ -16,7 +16,8 @@ maxp_sa( scale_method = "standardize", distance_method = "euclidean", random_seed = 123456789, - cpu_threads = 6 + cpu_threads = 6, + rdist = numeric() ) } \arguments{ @@ -43,6 +44,8 @@ maxp_sa( \item{random_seed}{(optional) The seed for random number generator. Defaults to 123456789.} \item{cpu_threads}{(optional) The number of cpu threads used for parallel computation} + +\item{rdist}{(optional) The distance matrix (lower triangular matrix, column wise storage)} } \value{ A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". diff --git a/man/maxp_tabu.Rd b/man/maxp_tabu.Rd index 1315e65d..5c4533c3 100644 --- a/man/maxp_tabu.Rd +++ b/man/maxp_tabu.Rd @@ -16,7 +16,8 @@ maxp_tabu( scale_method = "standardize", distance_method = "euclidean", random_seed = 123456789, - cpu_threads = 6 + cpu_threads = 6, + rdist = numeric() ) } \arguments{ @@ -43,6 +44,8 @@ maxp_tabu( \item{random_seed}{(optional) The seed for random number generator. Defaults to 123456789.} \item{cpu_threads}{(optional) The number of cpu threads used for parallel computation} + +\item{rdist}{(optional) The distance matrix (lower triangular matrix, column wise storage)} } \value{ A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". diff --git a/man/redcap.Rd b/man/redcap.Rd index 08962b8e..487f331d 100644 --- a/man/redcap.Rd +++ b/man/redcap.Rd @@ -14,7 +14,8 @@ redcap( scale_method = "standardize", distance_method = "euclidean", random_seed = 123456789, - cpu_threads = 6 + cpu_threads = 6, + rdist = numeric() ) } \arguments{ @@ -37,6 +38,8 @@ redcap( \item{random_seed}{(int,optional) The seed for random number generator. Defaults to 123456789.} \item{cpu_threads}{(optional) The number of cpu threads used for parallel computation} + +\item{rdist}{(optional) The distance matrix (lower triangular matrix, column wise storage)} } \value{ A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". diff --git a/man/schc.Rd b/man/schc.Rd index f4cfb4ee..f1aa4684 100644 --- a/man/schc.Rd +++ b/man/schc.Rd @@ -12,7 +12,8 @@ schc( bound_variable = data.frame(), min_bound = 0, scale_method = "standardize", - distance_method = "euclidean" + distance_method = "euclidean", + rdist = numeric() ) } \arguments{ @@ -31,6 +32,8 @@ schc( \item{scale_method}{One of the scaling methods {'raw', 'standardize', 'demean', 'mad', 'range_standardize', 'range_adjust'} to apply on input data. Default is 'standardize' (Z-score normalization).} \item{distance_method}{(optional) The distance method used to compute the distance betwen observation i and j. Defaults to "euclidean". Options are "euclidean" and "manhattan"} + +\item{rdist}{(optional) The distance matrix (lower triangular matrix, column wise storage)} } \value{ A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". diff --git a/man/skater.Rd b/man/skater.Rd index 24b26005..0efd2eed 100644 --- a/man/skater.Rd +++ b/man/skater.Rd @@ -13,7 +13,8 @@ skater( scale_method = "standardize", distance_method = "euclidean", random_seed = 123456789, - cpu_threads = 6 + cpu_threads = 6, + rdist = numeric() ) } \arguments{ @@ -34,10 +35,10 @@ skater( \item{random_seed}{(int,optional) The seed for random number generator. Defaults to 123456789.} \item{cpu_threads}{(optional) The number of cpu threads used for parallel computation} + +\item{rdist}{(optional) The distance matrix (lower triangular matrix, column wise storage)} } \value{ -A list of numeric vectors represents a group of clusters - A names list with names "Clusters", "Total sum of squares", "Within-cluster sum of squares", "Total within-cluster sum of squares", and "The ratio of between to total sum of squares". } \description{ diff --git a/man/spatial_validation.Rd b/man/spatial_validation.Rd index 55ca3e4f..4d45e6af 100644 --- a/man/spatial_validation.Rd +++ b/man/spatial_validation.Rd @@ -19,7 +19,7 @@ A list with names "Is Spatially Constrained", "Fragmentation", "Join Count Ratio } \description{ Spatial validation provides a collection of validation measures including -1. fragmentations (entropy, simpson), 2. join count ratio, 3. compactness (isoperimeter quotient) +1. fragmentations (entropy, simpson), 2. join count ratio, 3. compactness (isoperimeter quotient) and 4. diameter. } \examples{ diff --git a/src/RcppExports.cpp b/src/RcppExports.cpp index e31deb68..8a2d257b 100644 --- a/src/RcppExports.cpp +++ b/src/RcppExports.cpp @@ -5,14 +5,9 @@ using namespace Rcpp; -#ifdef RCPP_USE_GLOBAL_ROSTREAM -Rcpp::Rostream& Rcpp::Rcout = Rcpp::Rcpp_cout_get(); -Rcpp::Rostream& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get(); -#endif - // p_skater -Rcpp::List p_skater(int k, SEXP xp_w, Rcpp::List& data, int n_vars, std::string scale_method, std::string distance_method, NumericVector& bound_vals, double min_bound, int seed, int cpu_threads); -RcppExport SEXP _rgeoda_p_skater(SEXP kSEXP, SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP seedSEXP, SEXP cpu_threadsSEXP) { +Rcpp::List p_skater(int k, SEXP xp_w, Rcpp::List& data, int n_vars, std::string scale_method, std::string distance_method, NumericVector& bound_vals, double min_bound, int seed, int cpu_threads, NumericVector& rdist); +RcppExport SEXP _rgeoda_p_skater(SEXP kSEXP, SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP seedSEXP, SEXP cpu_threadsSEXP, SEXP rdistSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -26,13 +21,14 @@ BEGIN_RCPP Rcpp::traits::input_parameter< double >::type min_bound(min_boundSEXP); Rcpp::traits::input_parameter< int >::type seed(seedSEXP); Rcpp::traits::input_parameter< int >::type cpu_threads(cpu_threadsSEXP); - rcpp_result_gen = Rcpp::wrap(p_skater(k, xp_w, data, n_vars, scale_method, distance_method, bound_vals, min_bound, seed, cpu_threads)); + Rcpp::traits::input_parameter< NumericVector& >::type rdist(rdistSEXP); + rcpp_result_gen = Rcpp::wrap(p_skater(k, xp_w, data, n_vars, scale_method, distance_method, bound_vals, min_bound, seed, cpu_threads, rdist)); return rcpp_result_gen; END_RCPP } // p_redcap -Rcpp::List p_redcap(int k, SEXP xp_w, Rcpp::List& data, int n_vars, std::string redcap_method, std::string scale_method, std::string distance_method, NumericVector& bound_vals, double min_bound, int seed, int cpu_threads); -RcppExport SEXP _rgeoda_p_redcap(SEXP kSEXP, SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP redcap_methodSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP seedSEXP, SEXP cpu_threadsSEXP) { +Rcpp::List p_redcap(int k, SEXP xp_w, Rcpp::List& data, int n_vars, std::string redcap_method, std::string scale_method, std::string distance_method, NumericVector& bound_vals, double min_bound, int seed, int cpu_threads, NumericVector& rdist); +RcppExport SEXP _rgeoda_p_redcap(SEXP kSEXP, SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP redcap_methodSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP seedSEXP, SEXP cpu_threadsSEXP, SEXP rdistSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -47,13 +43,14 @@ BEGIN_RCPP Rcpp::traits::input_parameter< double >::type min_bound(min_boundSEXP); Rcpp::traits::input_parameter< int >::type seed(seedSEXP); Rcpp::traits::input_parameter< int >::type cpu_threads(cpu_threadsSEXP); - rcpp_result_gen = Rcpp::wrap(p_redcap(k, xp_w, data, n_vars, redcap_method, scale_method, distance_method, bound_vals, min_bound, seed, cpu_threads)); + Rcpp::traits::input_parameter< NumericVector& >::type rdist(rdistSEXP); + rcpp_result_gen = Rcpp::wrap(p_redcap(k, xp_w, data, n_vars, redcap_method, scale_method, distance_method, bound_vals, min_bound, seed, cpu_threads, rdist)); return rcpp_result_gen; END_RCPP } // p_schc -Rcpp::List p_schc(int k, SEXP xp_w, Rcpp::List& data, int n_vars, std::string linkage_method, std::string scale_method, std::string distance_method, NumericVector& bound_vals, double min_bound); -RcppExport SEXP _rgeoda_p_schc(SEXP kSEXP, SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP linkage_methodSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP) { +Rcpp::List p_schc(int k, SEXP xp_w, Rcpp::List& data, int n_vars, std::string linkage_method, std::string scale_method, std::string distance_method, NumericVector& bound_vals, double min_bound, NumericVector& rdist); +RcppExport SEXP _rgeoda_p_schc(SEXP kSEXP, SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP linkage_methodSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP rdistSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -66,13 +63,14 @@ BEGIN_RCPP Rcpp::traits::input_parameter< std::string >::type distance_method(distance_methodSEXP); Rcpp::traits::input_parameter< NumericVector& >::type bound_vals(bound_valsSEXP); Rcpp::traits::input_parameter< double >::type min_bound(min_boundSEXP); - rcpp_result_gen = Rcpp::wrap(p_schc(k, xp_w, data, n_vars, linkage_method, scale_method, distance_method, bound_vals, min_bound)); + Rcpp::traits::input_parameter< NumericVector& >::type rdist(rdistSEXP); + rcpp_result_gen = Rcpp::wrap(p_schc(k, xp_w, data, n_vars, linkage_method, scale_method, distance_method, bound_vals, min_bound, rdist)); return rcpp_result_gen; END_RCPP } // p_maxp_greedy -Rcpp::List p_maxp_greedy(SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& bound_vals, double min_bound, int iterations, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, int cpu_threads); -RcppExport SEXP _rgeoda_p_maxp_greedy(SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP iterationsSEXP, SEXP init_regionsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP seedSEXP, SEXP cpu_threadsSEXP) { +Rcpp::List p_maxp_greedy(SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& bound_vals, double min_bound, int iterations, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, int cpu_threads, NumericVector& rdist); +RcppExport SEXP _rgeoda_p_maxp_greedy(SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP iterationsSEXP, SEXP init_regionsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP seedSEXP, SEXP cpu_threadsSEXP, SEXP rdistSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -87,13 +85,14 @@ BEGIN_RCPP Rcpp::traits::input_parameter< std::string >::type distance_method(distance_methodSEXP); Rcpp::traits::input_parameter< int >::type seed(seedSEXP); Rcpp::traits::input_parameter< int >::type cpu_threads(cpu_threadsSEXP); - rcpp_result_gen = Rcpp::wrap(p_maxp_greedy(xp_w, data, n_vars, bound_vals, min_bound, iterations, init_regions, scale_method, distance_method, seed, cpu_threads)); + Rcpp::traits::input_parameter< NumericVector& >::type rdist(rdistSEXP); + rcpp_result_gen = Rcpp::wrap(p_maxp_greedy(xp_w, data, n_vars, bound_vals, min_bound, iterations, init_regions, scale_method, distance_method, seed, cpu_threads, rdist)); return rcpp_result_gen; END_RCPP } // p_maxp_sa -Rcpp::List p_maxp_sa(SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& bound_vals, double min_bound, int iterations, double cooling_rate, int sa_maxit, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, int cpu_threads); -RcppExport SEXP _rgeoda_p_maxp_sa(SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP iterationsSEXP, SEXP cooling_rateSEXP, SEXP sa_maxitSEXP, SEXP init_regionsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP seedSEXP, SEXP cpu_threadsSEXP) { +Rcpp::List p_maxp_sa(SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& bound_vals, double min_bound, int iterations, double cooling_rate, int sa_maxit, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, int cpu_threads, NumericVector& rdist); +RcppExport SEXP _rgeoda_p_maxp_sa(SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP iterationsSEXP, SEXP cooling_rateSEXP, SEXP sa_maxitSEXP, SEXP init_regionsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP seedSEXP, SEXP cpu_threadsSEXP, SEXP rdistSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -110,13 +109,14 @@ BEGIN_RCPP Rcpp::traits::input_parameter< std::string >::type distance_method(distance_methodSEXP); Rcpp::traits::input_parameter< int >::type seed(seedSEXP); Rcpp::traits::input_parameter< int >::type cpu_threads(cpu_threadsSEXP); - rcpp_result_gen = Rcpp::wrap(p_maxp_sa(xp_w, data, n_vars, bound_vals, min_bound, iterations, cooling_rate, sa_maxit, init_regions, scale_method, distance_method, seed, cpu_threads)); + Rcpp::traits::input_parameter< NumericVector& >::type rdist(rdistSEXP); + rcpp_result_gen = Rcpp::wrap(p_maxp_sa(xp_w, data, n_vars, bound_vals, min_bound, iterations, cooling_rate, sa_maxit, init_regions, scale_method, distance_method, seed, cpu_threads, rdist)); return rcpp_result_gen; END_RCPP } // p_maxp_tabu -Rcpp::List p_maxp_tabu(SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& bound_vals, double min_bound, int iterations, int tabu_length, int conv_tabu, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, int cpu_threads); -RcppExport SEXP _rgeoda_p_maxp_tabu(SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP iterationsSEXP, SEXP tabu_lengthSEXP, SEXP conv_tabuSEXP, SEXP init_regionsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP seedSEXP, SEXP cpu_threadsSEXP) { +Rcpp::List p_maxp_tabu(SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& bound_vals, double min_bound, int iterations, int tabu_length, int conv_tabu, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, int cpu_threads, NumericVector& rdist); +RcppExport SEXP _rgeoda_p_maxp_tabu(SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP iterationsSEXP, SEXP tabu_lengthSEXP, SEXP conv_tabuSEXP, SEXP init_regionsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP seedSEXP, SEXP cpu_threadsSEXP, SEXP rdistSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -133,13 +133,14 @@ BEGIN_RCPP Rcpp::traits::input_parameter< std::string >::type distance_method(distance_methodSEXP); Rcpp::traits::input_parameter< int >::type seed(seedSEXP); Rcpp::traits::input_parameter< int >::type cpu_threads(cpu_threadsSEXP); - rcpp_result_gen = Rcpp::wrap(p_maxp_tabu(xp_w, data, n_vars, bound_vals, min_bound, iterations, tabu_length, conv_tabu, init_regions, scale_method, distance_method, seed, cpu_threads)); + Rcpp::traits::input_parameter< NumericVector& >::type rdist(rdistSEXP); + rcpp_result_gen = Rcpp::wrap(p_maxp_tabu(xp_w, data, n_vars, bound_vals, min_bound, iterations, tabu_length, conv_tabu, init_regions, scale_method, distance_method, seed, cpu_threads, rdist)); return rcpp_result_gen; END_RCPP } // p_azp_greedy -Rcpp::List p_azp_greedy(int p, SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& bound_vals, double min_bound, int inits, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed); -RcppExport SEXP _rgeoda_p_azp_greedy(SEXP pSEXP, SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP initsSEXP, SEXP init_regionsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP seedSEXP) { +Rcpp::List p_azp_greedy(int p, SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& bound_vals, double min_bound, int inits, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, NumericVector& rdist); +RcppExport SEXP _rgeoda_p_azp_greedy(SEXP pSEXP, SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP initsSEXP, SEXP init_regionsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP seedSEXP, SEXP rdistSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -154,13 +155,14 @@ BEGIN_RCPP Rcpp::traits::input_parameter< std::string >::type scale_method(scale_methodSEXP); Rcpp::traits::input_parameter< std::string >::type distance_method(distance_methodSEXP); Rcpp::traits::input_parameter< int >::type seed(seedSEXP); - rcpp_result_gen = Rcpp::wrap(p_azp_greedy(p, xp_w, data, n_vars, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed)); + Rcpp::traits::input_parameter< NumericVector& >::type rdist(rdistSEXP); + rcpp_result_gen = Rcpp::wrap(p_azp_greedy(p, xp_w, data, n_vars, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed, rdist)); return rcpp_result_gen; END_RCPP } // p_azp_sa -Rcpp::List p_azp_sa(int p, SEXP xp_w, Rcpp::List& data, int n_vars, double cooling_rate, int sa_maxit, NumericVector& bound_vals, double min_bound, int inits, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed); -RcppExport SEXP _rgeoda_p_azp_sa(SEXP pSEXP, SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP cooling_rateSEXP, SEXP sa_maxitSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP initsSEXP, SEXP init_regionsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP seedSEXP) { +Rcpp::List p_azp_sa(int p, SEXP xp_w, Rcpp::List& data, int n_vars, double cooling_rate, int sa_maxit, NumericVector& bound_vals, double min_bound, int inits, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, NumericVector& rdist); +RcppExport SEXP _rgeoda_p_azp_sa(SEXP pSEXP, SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP cooling_rateSEXP, SEXP sa_maxitSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP initsSEXP, SEXP init_regionsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP seedSEXP, SEXP rdistSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -177,13 +179,14 @@ BEGIN_RCPP Rcpp::traits::input_parameter< std::string >::type scale_method(scale_methodSEXP); Rcpp::traits::input_parameter< std::string >::type distance_method(distance_methodSEXP); Rcpp::traits::input_parameter< int >::type seed(seedSEXP); - rcpp_result_gen = Rcpp::wrap(p_azp_sa(p, xp_w, data, n_vars, cooling_rate, sa_maxit, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed)); + Rcpp::traits::input_parameter< NumericVector& >::type rdist(rdistSEXP); + rcpp_result_gen = Rcpp::wrap(p_azp_sa(p, xp_w, data, n_vars, cooling_rate, sa_maxit, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed, rdist)); return rcpp_result_gen; END_RCPP } // p_azp_tabu -Rcpp::List p_azp_tabu(int p, SEXP xp_w, Rcpp::List& data, int n_vars, int tabu_length, int conv_tabu, NumericVector& bound_vals, double min_bound, int inits, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed); -RcppExport SEXP _rgeoda_p_azp_tabu(SEXP pSEXP, SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP tabu_lengthSEXP, SEXP conv_tabuSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP initsSEXP, SEXP init_regionsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP seedSEXP) { +Rcpp::List p_azp_tabu(int p, SEXP xp_w, Rcpp::List& data, int n_vars, int tabu_length, int conv_tabu, NumericVector& bound_vals, double min_bound, int inits, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, NumericVector& rdist); +RcppExport SEXP _rgeoda_p_azp_tabu(SEXP pSEXP, SEXP xp_wSEXP, SEXP dataSEXP, SEXP n_varsSEXP, SEXP tabu_lengthSEXP, SEXP conv_tabuSEXP, SEXP bound_valsSEXP, SEXP min_boundSEXP, SEXP initsSEXP, SEXP init_regionsSEXP, SEXP scale_methodSEXP, SEXP distance_methodSEXP, SEXP seedSEXP, SEXP rdistSEXP) { BEGIN_RCPP Rcpp::RObject rcpp_result_gen; Rcpp::RNGScope rcpp_rngScope_gen; @@ -200,7 +203,8 @@ BEGIN_RCPP Rcpp::traits::input_parameter< std::string >::type scale_method(scale_methodSEXP); Rcpp::traits::input_parameter< std::string >::type distance_method(distance_methodSEXP); Rcpp::traits::input_parameter< int >::type seed(seedSEXP); - rcpp_result_gen = Rcpp::wrap(p_azp_tabu(p, xp_w, data, n_vars, tabu_length, conv_tabu, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed)); + Rcpp::traits::input_parameter< NumericVector& >::type rdist(rdistSEXP); + rcpp_result_gen = Rcpp::wrap(p_azp_tabu(p, xp_w, data, n_vars, tabu_length, conv_tabu, bound_vals, min_bound, inits, init_regions, scale_method, distance_method, seed, rdist)); return rcpp_result_gen; END_RCPP } @@ -1235,15 +1239,15 @@ END_RCPP } static const R_CallMethodDef CallEntries[] = { - {"_rgeoda_p_skater", (DL_FUNC) &_rgeoda_p_skater, 10}, - {"_rgeoda_p_redcap", (DL_FUNC) &_rgeoda_p_redcap, 11}, - {"_rgeoda_p_schc", (DL_FUNC) &_rgeoda_p_schc, 9}, - {"_rgeoda_p_maxp_greedy", (DL_FUNC) &_rgeoda_p_maxp_greedy, 11}, - {"_rgeoda_p_maxp_sa", (DL_FUNC) &_rgeoda_p_maxp_sa, 13}, - {"_rgeoda_p_maxp_tabu", (DL_FUNC) &_rgeoda_p_maxp_tabu, 13}, - {"_rgeoda_p_azp_greedy", (DL_FUNC) &_rgeoda_p_azp_greedy, 11}, - {"_rgeoda_p_azp_sa", (DL_FUNC) &_rgeoda_p_azp_sa, 13}, - {"_rgeoda_p_azp_tabu", (DL_FUNC) &_rgeoda_p_azp_tabu, 13}, + {"_rgeoda_p_skater", (DL_FUNC) &_rgeoda_p_skater, 11}, + {"_rgeoda_p_redcap", (DL_FUNC) &_rgeoda_p_redcap, 12}, + {"_rgeoda_p_schc", (DL_FUNC) &_rgeoda_p_schc, 10}, + {"_rgeoda_p_maxp_greedy", (DL_FUNC) &_rgeoda_p_maxp_greedy, 12}, + {"_rgeoda_p_maxp_sa", (DL_FUNC) &_rgeoda_p_maxp_sa, 14}, + {"_rgeoda_p_maxp_tabu", (DL_FUNC) &_rgeoda_p_maxp_tabu, 14}, + {"_rgeoda_p_azp_greedy", (DL_FUNC) &_rgeoda_p_azp_greedy, 12}, + {"_rgeoda_p_azp_sa", (DL_FUNC) &_rgeoda_p_azp_sa, 14}, + {"_rgeoda_p_azp_tabu", (DL_FUNC) &_rgeoda_p_azp_tabu, 14}, {"_rgeoda_p_spatialvalidation", (DL_FUNC) &_rgeoda_p_spatialvalidation, 3}, {"_rgeoda_p_joincount_ratio", (DL_FUNC) &_rgeoda_p_joincount_ratio, 2}, {"_rgeoda_p_make_spatial", (DL_FUNC) &_rgeoda_p_make_spatial, 2}, diff --git a/src/libgeoda b/src/libgeoda index 9d8499c5..d226effd 160000 --- a/src/libgeoda +++ b/src/libgeoda @@ -1 +1 @@ -Subproject commit 9d8499c57ede938d2f129b9ea0811a2d94924b2d +Subproject commit d226effd9171279713fe46750221919467a3f3a4 diff --git a/src/rcpp_clustering.cpp b/src/rcpp_clustering.cpp index 17c7e3ff..eb7a23e4 100644 --- a/src/rcpp_clustering.cpp +++ b/src/rcpp_clustering.cpp @@ -38,9 +38,32 @@ Rcpp::List _create_clustering_result(int num_obs, const std::vector dist = as >(rdist); + double** matrix = (double**)malloc(n*sizeof(double*)); + matrix[0] = NULL; + for (int i = 1; i < n; i++) { + matrix[i] = (double*)malloc(i*sizeof(double)); + } + int m = (n - 1) * n / 2; + for (int i = 1; i < n; i++) { + for (int j = 0; j < i; j++) { + int r = i > j ? i : j; + int c = i < j ? i : j; + int idx = m - (n - c - 1) * (n - c) / 2 + (r -c) -1 ; + matrix[i][j] = dist[idx]; + } + } + return matrix; +} + // [[Rcpp::export]] Rcpp::List p_skater(int k, SEXP xp_w, Rcpp::List& data, int n_vars, std::string scale_method, std::string distance_method, - NumericVector& bound_vals, double min_bound, int seed, int cpu_threads) + NumericVector& bound_vals, double min_bound, int seed, int cpu_threads, NumericVector& rdist) { // grab the object as a XPtr (smart pointer) to LISA Rcpp::XPtr ptr(xp_w); @@ -55,14 +78,25 @@ Rcpp::List p_skater(int k, SEXP xp_w, Rcpp::List& data, int n_vars, std::string std::vector raw_bound = as >(bound_vals); - std::vector > cluster_ids = gda_skater(k, w, raw_data, scale_method, distance_method, raw_bound, min_bound, seed, cpu_threads); + int num_obs = w->GetNumObs(); + double** dist_matrix = rdist_matrix(num_obs, rdist); + + Rcout << "aaa" << dist_matrix; + std::vector > cluster_ids = gda_skater(k, w, raw_data, scale_method, distance_method, raw_bound, min_bound, seed, cpu_threads, dist_matrix); + + Rcout << "after gda_skater"; + if (dist_matrix) { + for (int i = 1; i < num_obs; i++) { + free(dist_matrix[i]); + } + } return _create_clustering_result(w->GetNumObs(), cluster_ids, raw_data); } // [[Rcpp::export]] Rcpp::List p_redcap(int k, SEXP xp_w, Rcpp::List& data, int n_vars, std::string redcap_method, std::string scale_method, std::string distance_method, - NumericVector& bound_vals, double min_bound, int seed, int cpu_threads) + NumericVector& bound_vals, double min_bound, int seed, int cpu_threads, NumericVector& rdist) { // grab the object as a XPtr (smart pointer) to LISA Rcpp::XPtr ptr(xp_w); @@ -76,14 +110,23 @@ Rcpp::List p_redcap(int k, SEXP xp_w, Rcpp::List& data, int n_vars, std::string } std::vector raw_bound = as >(bound_vals); - std::vector > cluster_ids = gda_redcap(k, w, raw_data, scale_method, redcap_method, distance_method, raw_bound, min_bound, seed, cpu_threads); + int num_obs = w->GetNumObs(); + double** dist_matrix = rdist_matrix(num_obs, rdist); + + std::vector > cluster_ids = gda_redcap(k, w, raw_data, scale_method, redcap_method, distance_method, raw_bound, min_bound, seed, cpu_threads, dist_matrix); + + if (dist_matrix) { + for (int i = 1; i < num_obs; i++) { + free(dist_matrix[i]); + } + } return _create_clustering_result(w->GetNumObs(), cluster_ids, raw_data); } // [[Rcpp::export]] Rcpp::List p_schc(int k, SEXP xp_w, Rcpp::List& data, int n_vars, std::string linkage_method, std::string scale_method, std::string distance_method, - NumericVector& bound_vals, double min_bound) + NumericVector& bound_vals, double min_bound, NumericVector& rdist) { // grab the object as a XPtr (smart pointer) to LISA Rcpp::XPtr ptr(xp_w); @@ -96,15 +139,23 @@ Rcpp::List p_schc(int k, SEXP xp_w, Rcpp::List& data, int n_vars, std::string li raw_data[i] = as >(tmp); } + int num_obs = w->GetNumObs(); + double** dist_matrix = rdist_matrix(num_obs, rdist); + std::vector raw_bound = as >(bound_vals); - std::vector > cluster_ids = gda_schc(k, w, raw_data, scale_method, linkage_method, distance_method, raw_bound, min_bound); + std::vector > cluster_ids = gda_schc(k, w, raw_data, scale_method, linkage_method, distance_method, raw_bound, min_bound, dist_matrix); + if (dist_matrix) { + for (int i = 1; i < num_obs; i++) { + free(dist_matrix[i]); + } + } return _create_clustering_result(w->GetNumObs(), cluster_ids, raw_data); } // [[Rcpp::export]] Rcpp::List p_maxp_greedy(SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& bound_vals, double min_bound, - int iterations, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, int cpu_threads) + int iterations, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, int cpu_threads, NumericVector& rdist) { // grab the object as a XPtr (smart pointer) to LISA Rcpp::XPtr ptr(xp_w); @@ -125,14 +176,21 @@ Rcpp::List p_maxp_greedy(SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& min_bounds.push_back(std::make_pair(min_bound, raw_bound)); } - std::vector > cluster_ids = gda_maxp_greedy(w, raw_data, scale_method, iterations, min_bounds, max_bounds, raw_init_regions, distance_method, seed, cpu_threads); + double** dist_matrix = rdist_matrix(num_obs, rdist); + + std::vector > cluster_ids = gda_maxp_greedy(w, raw_data, scale_method, iterations, min_bounds, max_bounds, raw_init_regions, distance_method, seed, cpu_threads, dist_matrix); + if (dist_matrix) { + for (int i = 1; i < num_obs; i++) { + free(dist_matrix[i]); + } + } return _create_clustering_result(w->GetNumObs(), cluster_ids, raw_data); } // [[Rcpp::export]] Rcpp::List p_maxp_sa(SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& bound_vals, double min_bound, - int iterations, double cooling_rate, int sa_maxit, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, int cpu_threads) + int iterations, double cooling_rate, int sa_maxit, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, int cpu_threads, NumericVector& rdist) { // grab the object as a XPtr (smart pointer) to LISA Rcpp::XPtr ptr(xp_w); @@ -153,14 +211,21 @@ Rcpp::List p_maxp_sa(SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& bou min_bounds.push_back(std::make_pair(min_bound, raw_bound)); } - std::vector > cluster_ids = gda_maxp_sa(w, raw_data, scale_method, iterations, cooling_rate, sa_maxit, min_bounds, max_bounds, raw_init_regions, distance_method, seed, cpu_threads); + double** dist_matrix = rdist_matrix(num_obs, rdist); + + std::vector > cluster_ids = gda_maxp_sa(w, raw_data, scale_method, iterations, cooling_rate, sa_maxit, min_bounds, max_bounds, raw_init_regions, distance_method, seed, cpu_threads, dist_matrix); + if (dist_matrix) { + for (int i = 1; i < num_obs; i++) { + free(dist_matrix[i]); + } + } return _create_clustering_result(w->GetNumObs(), cluster_ids, raw_data); } // [[Rcpp::export]] Rcpp::List p_maxp_tabu(SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& bound_vals, double min_bound, - int iterations, int tabu_length, int conv_tabu, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, int cpu_threads) + int iterations, int tabu_length, int conv_tabu, NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, int cpu_threads, NumericVector& rdist) { // grab the object as a XPtr (smart pointer) to LISA Rcpp::XPtr ptr(xp_w); @@ -181,14 +246,21 @@ Rcpp::List p_maxp_tabu(SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& b min_bounds.push_back(std::make_pair(min_bound, raw_bound)); } - std::vector > cluster_ids = gda_maxp_tabu(w, raw_data, scale_method, iterations, tabu_length, conv_tabu, min_bounds, max_bounds, raw_init_regions, distance_method, seed, cpu_threads); + double** dist_matrix = rdist_matrix(num_obs, rdist); + + std::vector > cluster_ids = gda_maxp_tabu(w, raw_data, scale_method, iterations, tabu_length, conv_tabu, min_bounds, max_bounds, raw_init_regions, distance_method, seed, cpu_threads, dist_matrix); + if (dist_matrix) { + for (int i = 1; i < num_obs; i++) { + free(dist_matrix[i]); + } + } return _create_clustering_result(w->GetNumObs(), cluster_ids, raw_data); } // [[Rcpp::export]] Rcpp::List p_azp_greedy(int p, SEXP xp_w, Rcpp::List& data, int n_vars, NumericVector& bound_vals, double min_bound, int inits, - NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed) + NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, NumericVector& rdist) { // grab the object as a XPtr (smart pointer) to Weight Rcpp::XPtr ptr(xp_w); @@ -209,7 +281,14 @@ Rcpp::List p_azp_greedy(int p, SEXP xp_w, Rcpp::List& data, int n_vars, Numeric min_bounds.push_back(std::make_pair(min_bound, raw_bound)); } - std::vector > cluster_ids = gda_azp_greedy(p, w, raw_data, scale_method, inits, min_bounds, max_bounds, raw_init_regions, distance_method, seed); + double** dist_matrix = rdist_matrix(num_obs, rdist); + + if (dist_matrix) { + for (int i = 1; i < num_obs; i++) { + free(dist_matrix[i]); + } + } + std::vector > cluster_ids = gda_azp_greedy(p, w, raw_data, scale_method, inits, min_bounds, max_bounds, raw_init_regions, distance_method, seed, dist_matrix); return _create_clustering_result(w->GetNumObs(), cluster_ids, raw_data); } @@ -217,7 +296,7 @@ Rcpp::List p_azp_greedy(int p, SEXP xp_w, Rcpp::List& data, int n_vars, Numeric // [[Rcpp::export]] Rcpp::List p_azp_sa(int p, SEXP xp_w, Rcpp::List& data, int n_vars, double cooling_rate, int sa_maxit, NumericVector& bound_vals, double min_bound, int inits, - NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed) + NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, NumericVector& rdist) { // grab the object as a XPtr (smart pointer) to LISA Rcpp::XPtr ptr(xp_w); @@ -238,15 +317,22 @@ Rcpp::List p_azp_sa(int p, SEXP xp_w, Rcpp::List& data, int n_vars, double cooli min_bounds.push_back(std::make_pair(min_bound, raw_bound)); } - std::vector > cluster_ids = gda_azp_sa(p, w, raw_data, scale_method, inits, cooling_rate, sa_maxit, min_bounds, max_bounds, raw_init_regions, distance_method, seed); + double** dist_matrix = rdist_matrix(num_obs, rdist); + std::vector > cluster_ids = gda_azp_sa(p, w, raw_data, scale_method, inits, cooling_rate, sa_maxit, min_bounds, max_bounds, raw_init_regions, distance_method, seed, dist_matrix); + + if (dist_matrix) { + for (int i = 1; i < num_obs; i++) { + free(dist_matrix[i]); + } + } return _create_clustering_result(w->GetNumObs(), cluster_ids, raw_data); } // [[Rcpp::export]] Rcpp::List p_azp_tabu(int p, SEXP xp_w, Rcpp::List& data, int n_vars, int tabu_length, int conv_tabu, NumericVector& bound_vals, double min_bound, int inits, - NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed) + NumericVector& init_regions, std::string scale_method, std::string distance_method, int seed, NumericVector& rdist) { // grab the object as a XPtr (smart pointer) to LISA Rcpp::XPtr ptr(xp_w); @@ -267,8 +353,15 @@ Rcpp::List p_azp_tabu(int p, SEXP xp_w, Rcpp::List& data, int n_vars, int tabu_l min_bounds.push_back(std::make_pair(min_bound, raw_bound)); } - std::vector > cluster_ids = gda_azp_tabu(p, w, raw_data, scale_method, inits, tabu_length, conv_tabu, min_bounds, max_bounds, raw_init_regions, distance_method, seed); + double** dist_matrix = rdist_matrix(num_obs, rdist); + std::vector > cluster_ids = gda_azp_tabu(p, w, raw_data, scale_method, inits, tabu_length, conv_tabu, min_bounds, max_bounds, raw_init_regions, distance_method, seed, dist_matrix); + + if (dist_matrix) { + for (int i = 1; i < num_obs; i++) { + free(dist_matrix[i]); + } + } return _create_clustering_result(w->GetNumObs(), cluster_ids, raw_data); } @@ -310,11 +403,11 @@ Rcpp::List p_spatialvalidation(SEXP xp_geoda, NumericVector& clusters, SEXP xp_w JoinCountRatio all_jcr = gda_all_joincount_ratio(result.joincount_ratio); Rcpp::List out_all_joincount = Rcpp::List::create( - Rcpp::Named("N") = all_jcr.n, + Rcpp::Named("N") = all_jcr.n, Rcpp::Named("Neighbors") = all_jcr.totalNeighbors, Rcpp::Named("Join Count") = all_jcr.totalJoinCount, - Rcpp::Named("Ratio") = all_jcr.ratio - ); + Rcpp::Named("Ratio") = all_jcr.ratio + ); Rcpp::List out_fragmentation = Rcpp::List::create( Rcpp::Named("#Clusters") = result.fragmentation.n, @@ -402,7 +495,7 @@ Rcpp::List p_spatialvalidation(SEXP xp_geoda, NumericVector& clusters, SEXP xp_w Rcpp::Named("JoinCountRatio") = out_joincount, Rcpp::Named("AllJoinCountRatio") = out_all_joincount, Rcpp::Named("Compactness") = "N/A: clusters are not spatially constrained.", - Rcpp::Named("Diameter") = "N/A: clusters are not spatially constrained." + Rcpp::Named("Diameter") = "N/A: clusters are not spatially constrained." ); return out; @@ -445,10 +538,10 @@ Rcpp::List p_joincount_ratio(NumericVector& clusters, SEXP xp_w) ); Rcpp::List out_all_joincount = Rcpp::List::create( - Rcpp::Named("N") = all_jcr.n, + Rcpp::Named("N") = all_jcr.n, Rcpp::Named("Neighbors") = all_jcr.totalNeighbors, Rcpp::Named("Join Count") = all_jcr.totalJoinCount, - Rcpp::Named("Ratio") = all_jcr.ratio + Rcpp::Named("Ratio") = all_jcr.ratio ); Rcpp::List out = Rcpp::List::create( @@ -456,7 +549,7 @@ Rcpp::List p_joincount_ratio(NumericVector& clusters, SEXP xp_w) Rcpp::Named("AllJoinCountRatio") = out_all_joincount ); - return out; + return out; } // [[Rcpp::export]] @@ -474,7 +567,7 @@ Rcpp::NumericVector p_make_spatial(NumericVector& clusters, SEXP xp_w) } std::vector result = gda_makespatial(raw_clusters, w); - + Rcpp::NumericVector out(result.begin(), result.end()); return out; -} \ No newline at end of file +} diff --git a/tests/testthat/test-clustering.R b/tests/testthat/test-clustering.R index c0da917e..355d47d3 100644 --- a/tests/testthat/test-clustering.R +++ b/tests/testthat/test-clustering.R @@ -40,7 +40,12 @@ testthat::test_that("skater", { queen_w <- queen_weights(guerry) data <- guerry[c("Crm_prs", "Crm_prp", "Litercy", "Donatns", "Infants", "Suicids")] - clusters <- skater(5, queen_w, data) + data$geometry = NULL + df <- scale(data) + dv <- as.vector(dist(df)) + data <- guerry[c("Crm_prs", "Crm_prp", "Litercy", "Donatns", "Infants", + "Suicids")] + clusters <- skater(5, queen_w, data, rdist = dv) testthat::expect_equal(clusters[[5]], 0.3763086809) })