raff-k / RainSlide

Rainfall-induced landslide analysis tools
GNU General Public License v3.0
3 stars 0 forks source link

Possible missing library import for thresh function #4

Closed ernesto561 closed 1 year ago

ernesto561 commented 1 year ago

When I try to use the function RainSlide::thresh I get the following error message:

Error in m %>% stats::predict(.) : could not find function "%>%"

If I import the magrittr package the error message is gone. In the description file, the magrittr package is a suggestion, I understand it's not imported. This is something that is easily managed, but it would be useful if this error message is not shown.

Thanks for the package.

raff-k commented 1 year ago

Thanks for the hint. I thought that dplyr would do the trick with %>%. I moved magrittr to Imports.

ernesto561 commented 1 year ago

Thanks. For some reason I don't understand, I still get the error message. If I load magrittr manually, everything works as expected.

According to this answer to a question in SO, this line should be added to the NAMESPACE file:

importFrom(magrittr,"%>%")

If you don't want to edit the NAMESPACE file manually, according to this answer, you can also add this line to your file:

#' @importFrom magrittr %>%

I haven't tested it, so I don't know if will work.

raff-k commented 1 year ago

thanks. I used use_pipe(export = TRUE) now, and hope that this issue is fixed now.

ernesto561 commented 1 year ago

Thanks, everything works perfectly now.