CRAN finds an warning that R CMD check --as-cran does not
Asked Answered
S

1

7

I am using 32-bit R 3.1.2 on Windows 7.

I recently conducted an R CMD check --as-cran on a recently-developed package and received only the 'New submission' note. Research here and on R-devel suggested this could be ignored. I also used devtools::build_win() and received no notes or warnings, other than the one mentioned previously. Further, I built the package locally with R CMD build and R CMD INSTALL --build and everything worked as it should, including the PDF manual.

Upon submission to CRAN, I was told that a warning was thrown:

    This fails to make its manual:

    * checking PDF version of manual ... WARNING
    LaTeX errors when creating PDF version.
    This typically indicates Rd problems.
    LaTeX errors found:
    ! Missing $ inserted.
    <inserted text>
                    $
    l.682 }{}

    ! Missing } inserted.
    <inserted text>
                    }
    l.682 }{}

    ...

    The line appears to be

    \widehat{R_1} = \frac{\sum\limits_{i=1}^n{c_i/n}}{\sum\limits_{i=1}^n{L_i/n}}

Additional research here suggests that I use win-builder.r-project.org/ to check my package on the development version and results from that test threw only the "New submission" warning.

I'm at loss. I can't replicate the error that CRAN found an everything appears to work correctly on my machine and on win-builder.r-project.org, too.

Can someone please help me with resolving this issue? I freely admit that I am not a LaTeX expert but given that the line wasn't an issue with R 3.1.2 on windows or the development version on win-build, I don't know where to begin.

Package information is available here:

creelSurvey

I used the inlinedocs package to write my functions and comments. The warning is coming from the .R, line 127:

this function

and the .Rd line 39:

this .Rd

Thanks for your help.

Scriptural answered 3/1, 2015 at 16:0 Comment(0)
V
5

I was able to reproduce this problem on Ubuntu 12.04 with r-devel by cloning the Github repo and running

R CMD build creelSurvey
R CMD check --as-cran BusRouteCreelSurvey_0.2.1.tar.gz

I was able to fix it by removing DOS end-of-line markers (^M or Ctrl-M) from man/SimulateBusRoute.Rd. I don't know the easiest way to do this on Windows (you could look for a dos2unix utility, or possibly come up with a readLines solution.

I don't know how it will work across platforms, but this seems to work for me:

fn <- "MakeAnglers.Rd"
r <- readLines(fn)
writeLines(r[nchar(r)>0],con="new.Rd")

I would (1) look for (possibly obscure) warnings in the R Extensions manual about end-of-line markers and then (2) report this, either to the CRAN maintainers or by posting on [email protected].

In general you should be able to detect these problems if you can set up a test build on a Linux system; I don't know of an equivalent of win-builder.r-project.org for Linux systems, but http://travis-ci.org is a good resource, and this Github project is a good way to get started with R projects on Travis. (Or you can set your project up on R-forge.) I recognize that this might be more of a project than you're looking for right now, just including it for future reference.

Vitalism answered 3/1, 2015 at 16:56 Comment(6)
Ah-ha! I have been running R CMD check --as-cran on the [package name] directory rather than on the .tar.gz which is likely the cause of my inability to reproduce the error. I'll work on the solution you provided. Thanks for your help.Scriptural
I'm not sure that is your problem. I think it might be an obscure cross-platform issue ... but the R CMD build ... process is recommended as best practice.Vitalism
This is my first attempt at building and deploying a package to CRAN and I thought I had identified and resolved all notes, warnings, and issues. Surprisingly, other than a suggestion to disambiguate the title of the package, the LaTeX/PDF warning was the only other issue. Given that package development is something I see myself doing in the future, setting this up on R-forge would be a useful exercise. Again, I'll work on the solution you provided and report back.Scriptural
OK. I would definitely encourage you to report this on r-devel (a very quick search for "dos", "end-of-line", etc. in the r extensions manual didn't turn anything up)Vitalism
My own quick search turned up little as well. I'll report this evening.Scriptural
I used your suggestion and it worked great. I resubmitted to CRAN and, in the meantime, reported the issue to r-devel. I was told that the issue was a function of "user error" rather than a cross-platform issue. Apparently, the line of LaTeX that was causing the issue should have been all on one line rather than spread across multiple lines: thread on r-devel. My attempt at making the .R file easier to read thwarted my abilities to package everything up.Scriptural

© 2022 - 2024 — McMap. All rights reserved.