I’m working through Pat’s R workshop file for making a matrix of median relative abundances at the phylum level. I would like to do this at the family level (or other), and I’m having a challenge manipulating the R function below. Does the forum have any thoughts on how to change the function to get family level data aggregated?
tax_no_confidence <- gsub(pattern="\(\d*\)", replacement="", x=taxonomy$Taxonomy)
phylum <- gsub(“Bacteria;([^;]);.”, “\1”, tax_no_confidence)
otu_phylum <- data.frame(otu = taxonomy$OTU, phylum = phylum, stringsAsFactors=F)