tidy.q_matrix | R Documentation |
Takes a q_matrix
object, which is a matrix, and returns a tidied tibble.
## S3 method for class 'q_matrix'
tidy(x, data, ...)
x |
A Q matrix object (as returned by |
data |
An associated tibble (e.g. a |
... |
not currently used |
A tidied tibble containing columns:
row |
ID of the original observation (i.e. rowname from original data). |
Q |
Integer indicating a Q component. |
value |
The proportion for that particular Q value. |
# run the example only if we have the package installed
if (requireNamespace("LEA", quietly = TRUE)) {
example_gt <- load_example_gt("gen_tbl")
# Create a gt_admix object
admix_obj <- example_gt %>% gt_snmf(k = 1:3, project = "force")
# Extract a Q matrix
q_mat_k3 <- get_q_matrix(admix_obj, k = 3, run = 1)
tidy(q_mat_k3, data = example_gt)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.