View source: R/jj_smooth_over_neighbours.R
jj_summarize_nearest_neighbour_data | R Documentation |
smooth values in a data.frame by taking the mean (numeric columns) or mode (character columns) among the k nearest neighbours for each cell (row)
jj_summarize_nearest_neighbour_data(dr_df, reduction_df, k = 30)
dr_df |
data.frame to smooth values over |
reduction_df |
data.frame with embeddings from dimensionality reduction (same nrow as dr_df) |
k |
number of nearest neighbours to smooth over for each cell |
emb_df = Embeddings(pbmc_small, 'tsne')
meta_df = pbmc_small[[]]
res = jj_summarize_nearest_neighbour_data(dr_df = meta_df, reduction_df = emb_df, k = 5)
pbmc_small$nCount_RNA_smoothed = res$nCount_RNA
pbmc_small$groups_smoothed = res$groups
jj_arrange_ggplots(jj_plot_features(pbmc_small, reduction = 'tsne',
meta_features = c('nCount_RNA','nCount_RNA_smoothed', 'groups', 'groups_smoothed'),
pt.size = 2, return_gg_object = T))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.