I have a twinData dataset that contains heights of twins (ht1 and ht2) and a sig_twin_cor table with a column called "similarity" which determines if the correlation between the heights is strong. I would like to facet the graph by cohort and zygosity, and then color the subplots with high similarity. I have the following code:
twinData %>%
left_join(sig_twin_cor, by = c("cohort")) %>%
ggplot(mapping = aes(ht1, ht2)) + geom_point(aes(color = ifelse(similarity == "Yes", "red", "black"))) +
facet_grid(cohort ~ zygosity) +
ggtitle("Cohort and Zygosity Facet Plot by Similarity")
but when I run it, an error says no applicable method for 'tbl_vars' can be applied to an object of class "c('gg', 'ggplot')". How could I solve this problem?