Each vector of input values is converted to a tibble organized in a "tidy" fashion.
qm_create(ref, key, value, rid, cid, category, ...)
ref | An |
---|---|
key | Name of geographic id variable in the |
value | A vector of input values created with |
rid | Respondent identification number; a user defined integer value that uniquely identifies respondents in the project |
cid | Cluster identification number; a user defined integer value that uniquely identifies clusters |
category | Category type; a user defined value that describes what the cluster represents |
... | An unquoted list of variables from the sf object to include in the output |
A tibble with the cluster values merged with elements of the reference data. This tibble is stored with
a custom class of qm_cluster
to facilitate data validation.
A cluster object contains a row for each feature in the reference data set. The key
variable
values are included in a variable named identically to the key
. Additionally, a variable called
COUNT
is created. This will always be equal to 1
for each observation. It is intended to be
used for summarization later in the data analysis process. Finally, three pieces of metadata are also included
as arguments to provide data for subsetting later: a respondent identification number (rid
), a
cluster identification number (cid
), and a category for the cluster type (category
). These
arguments are converted into values for the output variables RID
, CID
, and CAT
respectively.
Input data for qm_create
are validated using qm_validate
as part of the cluster object
creation process.
qm_define
, qm_validate
# 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_obj1 <- qm_create(ref = stl, key = TRACTCE, value = cluster, rid = 1, cid = 1, category = "positive") # create cluster object with additional variables added from reference data cluster_obj2 <- qm_create(ref = stl, key = TRACTCE, value = cluster, rid = 1, cid = 1, category = "positive", NAME, NAMELSAD)