Skip to content

[Question] How to make a system command in fread() pass CRAN Windows checks? #1110

Closed

Description

@rmscriven

Hi guys. I'm wondering if you can give me a push in the right direction. My package, retrosheet, fails Windows CRAN checks for r-release and r-oldrel, but passes the Windows r-devel check. Here are the check results.

http://cran.r-project.org/web/checks/check_results_retrosheet.html

The culprit line is on line 59 of

https://github.com/rmscriven/retrosheet/blob/master/R/getPartialGamelog.R

Specifically, CRAN reports the following,

Syntax error: end of file unexpected (expecting ")")
Warning: running command 'sh.exe -c (grep '20120825' GL2012.TXT) > D:\temp\RtmpC8Rfyr\file16485edb70d9' had status 2
Warning in shell(paste("(", input, ") > ", tt, sep = "")) :
 '(grep '20120825' GL2012.TXT) > D:\temp\RtmpC8Rfyr\file16485edb70d9' execution failed with error code 2
Error in fread(command, header = FALSE, select = sel) :
 File not found: D:\temp\RtmpC8Rfyr\file16485edb70d9
Calls: getPartialGamelog -> fread
Execution halted

I'm hoping you might be able to give me a few pointers on how to get the function to pass all Windows checks, as I am having trouble going about it.

Cheers.

Activity

  1. changed the title [-][Question] How to make a system command in fread() pass certain CRAN checks?[/-] [+][Question] How to make a system command in fread() pass CRAN Windows checks?[/+] on Apr 10, 2015
  2. jangorecki commented on Apr 10, 2015

    @jangorecki
    Member

    Did 1.0.0 version of your package pass cran check OK for those OSes?
    You are using shell commands like grep which I believe is heavy OS dependent.

    Can't help you much but I recommend to setup travis-ci, it helps quite a lot. Recently it gets native support for R which makes it much simpler to setup (example logR/.travis.yml).

    Also you can link a line in file directly by adding #L59 to url: getPartialGamelog.R#L59

  3. rmscriven commented on Apr 12, 2015

    @rmscriven
    Author

    After thinking about this, in long-run there will probably be more arguments added to getPartialGamelog() and a system command may complicate things. So for now I've decided to take the safe route and do some pre-processing on the file before calling fread().

    @jangorecki - thanks for the tips, I'll definitely have a look at travis-ci.

    Closing this issue.

  4. arunsrinivasan commented on Apr 12, 2015

    @arunsrinivasan
    Member

    Thanks for the report. I've tested this with R versions 3.0.3, 3.1.1 and 3.1.3, with data.table versions 1.9.2, 1.9.4 and 1.9.5 on windows 8.1, with corresponding Rtools versions.. Not able to reproduce at all.

    I'll keep it open because the issue seems to be in fread.

  5. rmscriven commented on Apr 12, 2015

    @rmscriven
    Author

    Thanks Arun. I wrote this temporary workaround for out.

    out <- if(is.null(date)) {
        fread(fname, select = sel, header = FALSE)
    } else if(is.character(date)) {
        ## get the first column only - this is the 'Date' column
        sc <- scan(fname, sep = ",", flush = TRUE, what = "", quote = "\"", quiet = TRUE)
        ## find rows of matched dates
        if(!length(wh <- which(sc == date))) {
            stop("invalid 'date' given")
        }
        ## read the file - selecting specified date and columns
        suppressWarnings(fread(fname, select = sel, header = FALSE, skip = min(wh)-1L, 
            nrows = diff(range(wh))))
    }
    ## set the names
    setnames(out, retrosheetFields$gamelog[sel])
    ## return the table
    out
    

    }

    Obviously there are other checks that have to happen now, which I omitted. Unfortunately this is a lot slower than using the grep command.

  6. arunsrinivasan commented on Sep 10, 2015

    @arunsrinivasan
    Member

    Can't reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions