plot_feature_summary {tempted}R Documentation

Plot nonparametric smoothed mean and error bands of features versus time

Description

This is a handy function to plot the smoothed mean and error bands for multiple features.

Usage

plot_feature_summary(
  feature_mat,
  time_vec,
  group_vec,
  coverage = 0.95,
  bws = NULL,
  nrow = 1
)

Arguments

feature_mat

A sample by feature matrix. Each feature will be plotted separately as a facet. The features can be original features, meta features, log ratios, or any variables of interest.

time_vec

A vector of time points matched to the rows of feature_mat.

group_vec

A vector of factor variable indicating the group membership of samples matched to the rows of feature_mat.

coverage

The coverage rate for the error band. Default is 0.95.

bws

The smoothness parameter for the smoothing lines and error bands. A larger value means a smoother line. Default is NULL and calculated by function np::npreg().

nrow

The number of rows to plot the features used in function ggplot2::facet_wrap().

Value

A ggplot2 object.

Examples

# plot the summary of selected features

feat.names <- c("OTU4447072", "OTU4467447")

proportion_table <- count_table/rowSums(count_table)

plot_feature_summary(proportion_table[,feat.names],
                     meta_table$day_of_life,
                     meta_table$delivery,
                     bws=30)

[Package tempted version 0.1.1 Index]