View source: R/extract_subpopulations.R
| extract_subpopulations | R Documentation | 
extract_subpopulations identifies clusters in the reference and
population sets and reports the frequency of points in each cluster for the
two sets.
extract_subpopulations(population, reference, variables, k)
| population | tbl with grouping (metadata) and observation variables. | 
| reference | tbl with grouping (metadata) and observation variables.
Columns of  | 
| variables | character vector specifying observation variables. | 
| k | scalar specifying number of clusters. | 
list containing clusters centers (subpop_centers), two
normalized histograms specifying frequency of each clusters in population
and reference (subpop_profiles), and cluster prediction and distance
to the predicted cluster for all input data (population_clusters and
reference_clusters).
data <- tibble::tibble(
  Metadata_group = c(
    "control", "control", "control", "control",
    "experiment", "experiment", "experiment", "experiment"
  ),
  AreaShape_Area = c(10, 12, NA, 16, 8, 8, 7, 7),
  AreaShape_Length = c(2, 3, NA, NA, 4, 5, 1, 5)
)
variables <- c("AreaShape_Area", "AreaShape_Length")
population <- dplyr::filter(data, Metadata_group == "experiment")
reference <- dplyr::filter(data, Metadata_group == "control")
extract_subpopulations(
  population = population,
  reference = reference,
  variables = variables,
  k = 3
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.