Skip to contents

Display missingness by trait, observation and phylogenetic tip order, or display the fraction of observations missing both traits. Patterns can suggest structure to investigate; they cannot establish whether data are missing completely at random. Trait groups expanded into multiple latent columns count as missing when all their columns are missing.

Usage

plot_missingness(
  x,
  type = c("summary", "matrix", "phylo", "co_missing"),
  tree = NULL
)

Arguments

x

A preprocessed pigauto_data object.

type

One of "summary", "matrix", "phylo", or "co_missing".

tree

A phylo tree, required for type = "phylo". Rows are ordered by its tip order; repeated observations appear together.

Value

Invisibly, a logical observation-by-trait missingness matrix.

Examples

data(avonet300, tree300)
tree <- ape::keep.tip(tree300, tree300$tip.label[seq_len(30)])
d <- avonet300[match(tree$tip.label, avonet300$Species_Key),
               c("Mass", "Wing.Length"), drop = FALSE]
rownames(d) <- tree$tip.label
d$Mass[1:3] <- NA
x <- preprocess_traits(d, tree)
plot_missingness(x, "summary")

plot_missingness(x, "phylo", tree)