When I run devtools::check()
for my package I get the following notes:
❯ checking R code for possible problems ... NOTE
IMPosterior: no visible binding for global variable ‘section’
IMPosterior: no visible binding for global variable ‘y’
IMPosterior: no visible binding for global variable ‘prob’
Undefined global functions or variables:
prob section y
How can I solve that? I believe this is the code that generates the problem:
# Calculate density values for input data
dens <- data.frame(stats::density(x, n=2^10, adjust=1)[c("x","y")]) %>%
dplyr::mutate(section = cut(x, breaks=breaks)) %>%
dplyr::group_by(section) %>%
dplyr::mutate(prob = paste0(round(sum(y)*mean(diff(x))*100),"%"))
Thanks!