Microbiome. aggregate_taxa. Error "values must be type 'integer'

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")

Doesn't that give you enough to fix it?

Otherwise, you don't need to share all the data. It just needs to be something that others can use to help you work out the problem. It could be made up.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.