Hi,
I have what seems like a simple question.
I am trying to calculate the relative percent of values greater than a certain value within a column of numbers.
My code is below. I first was able to get the correct number of samples >0.04 using tally. And I can tally for total number of samples >0. In this case, since I only have four groups, I can use a calculator and figure out the %. But, I am sure there must be a more efficient method.
Thank you.
exceed<- moor4 %>%
filter(code == "tp") %>%
group_by(station) %>%
tally(adj2>0.04)
#> Error in moor4 %>% filter(code == "tp") %>% group_by(station) %>% tally(adj2 > : could not find function "%>%"
exceed
#> Error in eval(expr, envir, enclos): object 'exceed' not found
exceed2<- moor4 %>%
filter(code == "tp") %>%
group_by(station) %>%
tally(adj2>0)/tally(adj2>0.04)
#> Error in moor4 %>% filter(code == "tp") %>% group_by(station) %>% tally(adj2 > : could not find function "%>%"
exceed2
#> Error in eval(expr, envir, enclos): object 'exceed2' not found
Created on 2021-08-25 by the reprex package (v2.0.1)