Take a table of taxonomic assignments, e.g. assignments from hits to a read, and condense it to a single vector with NAs where there are disagreements between the hits.
Usage
condenseTaxa(taxaTable, groupings = rep(1, nrow(taxaTable)))
Arguments
- taxaTable
a matrix or data.frame with hits on the rows and various levels of taxonomy in the columns
- groupings
a vector of groups e.g. read queries to condense taxa within
Value
a matrix with ncol(taxaTable)
taxonomy columns with a row for each unique id (labelled on rownames) with NAs where there was not complete agreement for an id
Examples
taxas<-matrix(c(
'a','b','c','e',
'a','b','d','e'
),nrow=2,byrow=TRUE)
condenseTaxa(taxas)
#> V1 V2 V3 V4
#> 1 "a" "b" NA NA
condenseTaxa(taxas[c(1,2,2),],c(1,1,2))
#> V1 V2 V3 V4
#> 1 "a" "b" NA NA
#> 2 "a" "b" "d" "e"