| selectK | R Documentation | 
We infer the number of patterns based on two metrics that have been implemented in the NMF R package, including Cophenetic and Silhouette. Both metrics measure the stability for a particular number of patterns based on a hierarchical clustering of the consensus matrix. For a range of the number of patterns, a suitable number of patterns is the one at which Cophenetic and Silhouette values begin to drop suddenly.
selectK(
  object,
  slot.name = "netP",
  pattern = c("outgoing", "incoming"),
  title.name = NULL,
  do.facet = TRUE,
  k.range = seq(2, 10),
  nrun = 30,
  seed.use = 10
)
| object | CellChat object | 
| slot.name | the slot name of object that is used to compute centrality measures of signaling networks | 
| pattern | "outgoing" or "incoming" | 
| title.name | title of plot | 
| do.facet | whether use facet plot showing the two measures | 
| k.range | a range of the number of patterns | 
| nrun | number of runs when performing NMF | 
| seed.use | seed when performing NMF | 
a ggplot object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.