我需要将我的OTU表从我的phyloseq对象转换成一个数据框架,这样我就可以使用它来运行PICRUSt2,但是as.data.frame(physeq@otu_table)
不会使它成为一个数据框架。我尝试了pie<-as.matrix(physeq@otu_table)
,当我说is.matrix(pie) #it says TRUE
时,但是当我说class(pie) #it says [1] "otu_table" attr(,"package") [1] "phyloseq"
时,它甚至不会假装是一个数据框架:
pie<-as.data.frame(physeq@otu_table)
is.data.frame(pie)
#FALSE
我不能只使用我的asv_mat之前,我把它放入系统对象,因为我必须删除线粒体和叶绿体从我的系统物体。这仍将出现在asv_mat中。
提前感谢
发布于 2021-03-09 17:06:53
pie<-as.matrix(physeq@otu_table)
pie<-as.data.frame(pie)
使其成为一个矩阵,然后将其保存为数据格式,并记住将原始矩阵保存为数据帧(即pie<-as.data.frame(pie)
而不仅仅是as.data.frame(pie)
)。
发布于 2021-03-09 08:33:30
对不起,我没有足够的信息来正确地帮助您,但是您是否尝试过使用tidyverse包中的as_tibble()而不是as_dataframe()呢?
https://stackoverflow.com/questions/66541417
复制相似问题