Skip to content

Instantly share code, notes, and snippets.

@karthik
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save karthik/8946564 to your computer and use it in GitHub Desktop.
Save karthik/8946564 to your computer and use it in GitHub Desktop.
My issues with dplyr failing intermittently (esp when examples are allowed to run).

CRAN maintainers now require that examples not be boxed in by the \dontrun{ tags. Since most of rOpenSci's packages retrieve data from the web, this can be problematic, especially if the API requires a key. But in cases where a key isn't required, I'm fine with allowing the examples to run.

When I use dplyr::rbind_all(list_name) over do.call(rbind, list_name) to combine data.frames, I get this issue when running a devtools::check().

> ### ** Examples
> 
> data_by_code <- aw_code(code = "casent0104669")
Warning in rbind_all(image_data) :
  Unequal factor levels: coercing to character
Warning in rbind_all(image_data) :
  Unequal factor levels: coercing to character
Warning in rbind_all(image_data) :
  Unequal factor levels: coercing to character
Warning in rbind_all(image_data) :
  Unequal factor levels: coercing to character
Error: incompatible type (data index: 3, column: 'img1', was collecting: character (dplyr::Collecter_Impl<16>), incompatible with data of type: INTSXP
Execution halted
Error: Command failed (1)

How to replicate the problem

git clone -b dplyr_issues https://github.com/ropensci/AntWeb.git
cd AntWeb
R
library(devtools)
check()

However, when the examples in master are set to not run, check runs fine.

git clone -b master https://github.com/ropensci/AntWeb.git
cd AntWeb
R
library(devtools)
check()

Exposing examples without using dplyr::rbind_all also works fine and passes all checks.

git clone -b no-dplyr https://github.com/ropensci/AntWeb.git
cd AntWeb
R
library(devtools)
check()
@richfitz
Copy link

Wat? CRAN is removing \dontrun?

@karthik
Copy link
Author

karthik commented Feb 11, 2014

This was my last complaint about CRAN. Brian Ripley wont accept my packages unless I allow the examples to run.

@hadley
Copy link

hadley commented Feb 12, 2014

Can you send me the email you get from BDR? And does this error occur when you run outside of check?

@karthik
Copy link
Author

karthik commented Feb 12, 2014

I'll forward that email thread to you shortly. The error almost never happen outside of check (see ecoengine/#36). On occasion, the dplyr::rbind_all call segfaults but I have not been able to reproduce it consistently.

@leeper
Copy link

leeper commented Feb 12, 2014

Ugh...so what does he want us to do with API clients?

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