Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 804
Steven Avatar asked Jan 03 '15 16:01

Steven


1 Answers

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.

like image 119
Ben Bolker Avatar answered Sep 24 '22 03:09

Ben Bolker