Given a samples-by-features matrix X and a subset vertex.ids
(either row names or integer row indices), compute for each feature (column)
the number k and proportion p of subset rows for which
X[row, feature] > eps.
This is useful as a lightweight prevalence/coverage summary within a basin
(or any vertex subset) when X contains relative abundances or counts.
Arguments
- X
A numeric matrix (or data.frame coercible to a numeric matrix) with samples/vertices in rows and features (e.g., phylotypes) in columns. Row names are required if
vertex.idsis character.- vertex.ids
A vector of row identifiers. May be character (matched to
rownames(X)) or numeric/integer (treated as 1-based row indices).- eps
A non-negative numeric threshold. A feature is considered present in a vertex if
X > eps. Default is 0.- drop.missing
Logical; if TRUE (default), when
vertex.idsis character, silently drop IDs not found inrownames(X). If FALSE, error on any missing IDs.
Value
A data.frame with two columns:
k: integer counts of vertices withX > epsp: numeric proportionsk / length(vertex.ids.resolved)
Row names correspond to colnames(X).