Hello
I am a newbie and R studio. I am trying working through a Microbiom annlyses and trying to use the aggregate_taxa command to aggregate OTU's by class. The OTU's are contained in txt files.
Bellow I have included the code I am using. The last line in bold produced the following error.
Error in vapply(otus, function(taxa) { : values must be type 'integer',
but FUN(X[[1]]) result is type 'double'
I am sorry I cannot provide the data so this question my not be entirely reproducible.
Any advise you have will be really appreciated!!
Thank you,
And any feedback on the way I asked this question is also welcome! I tried to follow the guidelines but am not sure how easy my question is to interpret.
Load packages
library("phyloseq")
library("RDPutils")
library("data.table")
library("ggplot2")
library("corrplot")
library("microbiome")
library("corrr")
otumat<- read.table("x.tsv.txt", header=T, row.names = 1, check.names = FALSE, sep = '\t')
otumat <- as.matrix(otumat[,])
otu = otu_table(otumat, taxa_are_rows = TRUE)
tax <- read.table("xx.txt", header=T, row.names = 1, sep = '\t')
tax<-as.matrix(tax)
tax<-tax_table(tax)
sampledata<-read.table("xxx.txt", header = T, row.names = 1)
sampledata$Branch<-as.factor(sampledata$Branch)
sampledata = sample_data(sampledata)
physeq = phyloseq(otu,sampledata, tax)
physeq = prune_taxa(taxa_sums(physeq) > 10, physeq)
newphyseqobj<-microbiome::aggregate_taxa(physeq, level = "Class")