Erin-Rooney/Y1_fairbanks

Relabund aov function issue

Closed this issue · 3 comments

@kaizadp

I can't figure out why this code isn't working.

relabund_aov_covertype =
fticr_water_relabund %>%
#filter(cover_type == "Open") %>%
group_by(slopepos, Class) %>%
do(fit_aov_open(.))

Error: Error in aov(relabund ~ cover_type, data = dat) %>% broom::tidy() %>% :
attempt to apply non-function

@kaizadp This issue is still giving me trouble.

fit_aov_open = function(dat){
aov(relabund ~ cover_type, data = dat) %>%
broom::tidy() %>% # convert to clean dataframe
rename(pvalue = `p.value`) %>%
filter(term == "cover_type") %>%
mutate(asterisk = case_when(pvalue <= 0.05 ~ "*")) %>%
dplyr::select(asterisk) %>% # we need only the asterisk column
# two steps below, we need to left-join.
# set Trtmt = "FTC" so the asterisks will be added to the FTC values only
mutate(cover_type = "Open") %>%
NULL
}

replace the NULL at the end with force()

UGHGHHGHGH. Yep. It works now. Thank you. I am going to make another issue for the XRD diffractogram disaster.