I am receiving this error when trying to subset specific groups from my phyloseq object:
Error in validObject(.Object) : invalid class “phyloseq” object:
Component sample names do not match.
The strange thing is that I can subset other groups just fine but for some reason, this group is giving me a hard time.
Here is what my phyloseq object looks like:
phyloseq-class experiment-level object
otu_table() OTU Table: [ 1918 taxa and 23 samples ]
sample_data() Sample Data: [ 23 samples by 3 sample variables ]
tax_table() Taxonomy Table: [ 1918 taxa by 7 taxonomic ranks ]
phy_tree() Phylogenetic Tree: [ 1918 tips and 1917 internal nodes ]
within sample_data , the 3 sample variables are Group (6 groups), Site (JB, OB, SP), and BodySite (Gut, Skin). The 'Group' is just a combo of site and BodySite. Like this: JB_Gut, JB_Skin, etc.
I've been able to isolate all groups except JB_Gut with the following code:
physeq_Site_BodySite <- subset_samples(physeq, Group == "thenameofgroup")
I tried using : physeq_JB_Skin <- subset_samples(physeq, Site == "JB" & BodySite == "Gut"), didn't work.
I tried removing all groups except JB_Gut, didn't work.
I've tried changing the metadata to include just those groups, and it's just not working!
I keep getting the same error.
What am I missing here?? Please help!