0

I encountered the same problem as in NAMESPACE not generated by roxygen2. Skipped I get Warning message: NAMESPACE not generated by roxygen2. Skipped. at the end of the R CMD check using devtools::check.

Here is how my NAMESPACE looks like (I exported all my functions)

export(prep)
export(read_data)
export(file_merge)
export(non_recursive_mc)
export(modified_recursive_mc)
export(hybrid_recursive_mc)
importFrom(dplyr,"%>%")
importFrom(psych,"harmonic.mean")
exportPattern("^[^\\.]")

If I put this comment # Generated by roxygen2 (4.1.1): do not edit by hand in the beginning of the NAMESPACE I get an ERROR when running devtools::check saying that it does know %>%.

How can I solve this warning message?

Best

Ayala

Community
  • 1
  • 1
ayalaall
  • 145
  • 2
  • 16
  • Try `importFrom(magrittr,"%>%")` - from memory this is where dplyr imports it from, though I'm not sure why your current one isn't working – jeremycg Aug 20 '15 at 13:26
  • 1
    Have you tried deleting the NAMESPACE file prior to building? Keep a backup somewhere if you need the information – Whitebeard Aug 20 '15 at 13:27
  • @SamThomas I deleted NAMESPACE like you said, but now I get an error `Error: could not find function "%>%"`. I opened the NAMESPACE now and all I hve there is: `# Generated by roxygen2 (4.1.1): do not edit by hand export(prep)`. If I add `importFrom(magrittr,"%>%")` and then run `devtools::check()` it deletes ``importFrom(magrittr,"%>%")` and then I get the same error `Error: could not find function "%>%"` – ayalaall Aug 20 '15 at 13:47
  • Every time you run `devtools::check()`, the `devtools::document()` function runs as well, which overwrites any changes to your NAMESPACE. This is why the comment at the top of NAMESPACE says not to edit the file by hand. Somewhere in your R code, there should be a file where you've used `importFrom dplyr "%>%"`. Change that to `importFrom magrittr "%>%"` and I would think that should resolve the problem. – Benjamin Aug 20 '15 at 14:00
  • @ayalaall This link may be helpful http://r-pkgs.had.co.nz/namespace.html. Per Benjamin's comment, I think you need to add `@importFrom magittr "%>%"` as an `roxygen2` comment – Whitebeard Aug 20 '15 at 14:02
  • Now that I read your comment again, perhaps you haven't been using the `roxygen` tags to document your functions. If that is the case, and you wish to manually edit your NAMESPACE, you can use `devtools::check(pkg = ..., document = FALSE)` – Benjamin Aug 20 '15 at 14:02
  • @Benjamin Thank you so much! It works. I followed your last suggestion and I don't get an ERROR now. BTW I do use `#'` tags to document my functions. – ayalaall Aug 23 '15 at 08:05

0 Answers0