I created a function (inside a package) that uses the package "dplyr". I used roxygen2 to document my function and I included #' @import dplyr
. Generally in my function I use dplyr::function
when I am call a particular function from a package. However, I am not sure how to use a similar structure to stop this error:
Error in data %>% dplyr::group_by(dir.binned) %>% dplyr::summarise(count = n()) %>% :
could not find function "%>%"
Code that is calling the error:
T_data <- data %>%
dplyr::group_by(dir.binned) %>%
dplyr::summarise(count= n()) %>%
dplyr::mutate(y = count/sum(count))
Does anyone know the best way to resolve this error?
Thanks!