Hi. I have been following the Qiime2R tutorial with my dataset. I am trying to plot a PCOA with ggplot2, but i am running into several errors. My commands are:
metadata <- read_excel("metadata.xlsx")
table<-read_qza("table-no-mitochondria-no-chloroplast.qza")
taxonomy<-read_qza("taxonomy.qza")
faithpd<-read_qza("faith_pd_vector.qza")
pcoa<-read_qza("unweighted_unifrac_pcoa_results.qza")pcoa$data$Vectors %>%
rename("#SampleID"=SampleID) %>% #rename to match the metadata table
left_join(metadata) %>%
left_join(faithpd$data %>% rownames_to_column("#SampleID")) %>%
ggplot(aes(x=PC1, y=PC2, shape=diet, color=host_order, size=faithpd)) +
geom_point() +
xlab(paste("PC1: ", round(100pcoa$data$ProportionExplained[1]), "%")) +
ylab(paste("PC2: ", round(100pcoa$data$ProportionExplained[2]), "%")) +
theme_bw() +
ggtitle("Filtered Unweighted UniFrac")
But I received the errors:
Joining, by = "#SampleID"
Joining, by = "#SampleID"
Error: Aesthetics must be either length 1 or the same as the data (53): size
In addition: Warning message:
Column #SampleID
joining factor and character vector, coercing into character vector
Below are the files which I've used:
unweighted_unifrac_pcoa_results.qza (146.2 KB) taxonomy.qza (262.3 KB) table-no-mitochondria-no-chloroplast.qza (421.9 KB) faith_pd_vector.qza (114.2 KB)
Metadata: muegge delsuc_mapping_file.txt (91.1 KB)
I have looked for solutions but still do not understand the errors to my case. I would appreciate any help with this, as I am still getting to know R.
Cheers!