qiime2r dyplr errro

i faced a problem while i was running qiime2r

i applied codes present in this Tutorial in the following link:

[qiime2r toturial]( Tutorial: Integrating QIIME2 and R for data visualization and analysis using qiime2R - Community Contributions / Tutorials - QIIME 2 Forum)

#shannon diversity


drawing shannon diversity versus time by this code:

metadata %>%
filter(!is.na(shannon)) %>%
ggplot(aes(x=days-since-experiment-start, y=shannon, color=body-site)) +
stat_summary(geom="errorbar", fun.data=mean_se, width=0) +
stat_summary(geom="line", fun.data=mean_se) +
stat_summary(geom="point", fun.data=mean_se) +
xlab("Days") +
ylab("Shannon Diversity") +
theme_q2r() + # try other themes like theme_bw() or theme_classic()
scale_color_viridis_d(name="Body Site") # use different color scale which is color blind friendly
ggsave("Shannon_by_time.pdf", height=3, width=4, device="pdf") # save a PDF 3 inches by 4 inches

results in this error:

Error: Problem with filter() input ..1.
i Input ..1 is !is.na(shannon).
x Input ..1 must be of size 34 or 1, not size 31.
qiime2r tutorial
sample-metadata.tsv (2.0 KB) qiime2rshannon.qza (69.1 KB) qiime2rtable.qza (52.9 KB) qiime2rtaxonomy.qza (92.4 KB)

Interesting, it would appear that for some reason your shannon data has been read in as a table object other than a data.frame. If you ever have this issue in the future you can use use the as.data.frame() function like this:

shannon<-shannon$data %>% as.data.frame() %>% rownames_to_column("SampleID")

I also note in your shannon diversity file, the metric is labelled as shannon_entropy so you will need to keep that in mind when you make you plot.

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