This function tests to see whether an object contains the characteristics of an object created by qm_cluster. It is used as part of the qm_combine and qm_summarize functions, and is exported so that it can be used interactively as well.

qm_is_cluster(obj, verbose = FALSE)

Arguments

obj

Object to test

verbose

A logical scalar; if TRUE, a tibble with test results is returned

Value

A logical scalar that is TRUE if the given object contains the approprite characteristics; if it does not, FALSE is returned.

See also

qm_combine, qm_summarize

Examples

# load and format reference data
stl <- stLouis
stl <- dplyr::mutate(stl, TRACTCE = as.numeric(TRACTCE))

# create cluster
cluster <- qm_define(118600, 119101, 119300)

# create simple cluster object
cluster_obj <- qm_create(ref = stl, key = TRACTCE, value = cluster,
    rid = 1, cid = 1, category = "positive")
#> old-style crs object detected; please recreate object with a recent sf::st_crs()

# test cluster object
qm_is_cluster(cluster_obj)
#> [1] TRUE
qm_is_cluster(cluster_obj, verbose = TRUE)
#> # A tibble: 4 × 2
#>   test                        result
#>   <chr>                       <lgl> 
#> 1 Contains at least 4 columns TRUE  
#> 2 Contains RID variable       TRUE  
#> 3 Contains CID variable       TRUE  
#> 4 Contains CAT variable       TRUE