ImportFrom function in NAMESPACE is removed by document ()

I get the error [cannot find the function "str_trim"

] when I run check()

in an R package that I am developing. Since then, I've added two things:

1) In DESCRIPTION
Imports: stringr

2) In NAMESPACE
importFrom(stringr,str_trim)

      

However, when I run install()

and document()

, then the line in NAMESPACE is removed. Then when I run again check()

I get the original error.

Why is this line being removed? Should I try a different approach, and if so, which approach? Thank!

+3


source to share


1 answer


You seem to be doing package development the "Hadley way". Hadley wants you to use roxygen (ie the roxygen2 package, but that should be automatic if you use his "devtools"). Then roxygen "magic" is used to automatically write your file NAMESPACE

... and therefore also destroys the things you put there. You should add @importFrom

.... operators to your R / *. R files if you want to use roxygen.



I agree with many of Hadley's supporters; however, there is no wholesale use of "roxigen" among them. I want good, carefully maintained help files with \ link {} s, \ eqn {}, etc. Etc. -> I edit my files man/*.Rd

and I manually create the NAMESPACE (so it looks well organized, I can add comments there too, and I can even use if(getRVersion() >= "3.2.0") {

...... }

in the file NAMESPACE

, which is not possible with roxygen.

+10


source







All Articles