Dear Community, I'm trying to run the code down below , however when I run it R keeps saying "Error: Can't subset columns that don't exist.
Column tree_id
doesn't exist." When I delete "tree_id" same Error refers to "plot_id", "block" and so on. What can I do to solve this?
DF10 <- mgs_raw_clean %>%
group_by_at(c("tree_id","plot_id","block","def_risk","treatment","tree_nr","oak_spec")) %>%
summarise(gall_pa = sum(gall_abund != 0),
agamous = sum(agamous), sexual = sum(sexual), single = sum(single), unknown = sum(unknown),
gall_abund = sum(gall_abund), .groups = "drop") %>%
mutate(total_galls = agamous + sexual + single + unknown + gall_abund) %>%
dplyr::select(c(tree_id, plot_id, block, def_risk, treatment, tree_nr, oak_spec,
n_leaves, mildew_cov, gall_pa, gall_abund, everything()))