New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added sanitise_dim function for Issue #801 #962

Merged
merged 7 commits into from Jun 18, 2015

Conversation

Projects
None yet
2 participants
@richierocks
Contributor

richierocks commented May 11, 2014

As discussed in issue #801, facet_wrap doesn't properly check the nrow and ncol arguments, particularly negative values.

I've added a sanitise_dim function (plus some tests) to deal with this.

#' sanitise_dim(0)
#' sanitise_dim("foo")
#' }
sanitise_dim <- function(n)

This comment has been minimized.

@hadley

hadley Jun 11, 2015

Member

Can you please use house style, e.g. http://r-pkgs.had.co.nz/r.html#style ?

I'd also rather not export this function, so either delete the roxygen comments or add @noRd

@@ -0,0 +1,76 @@
test_that(
"sanitise_dim returns NULL for zero-length inputs, with appropriate warnings",

This comment has been minimized.

@hadley

hadley Jun 11, 2015

Member

This seems like way too many unit tests for such a simple function. Could you please simplify focussing on the highest risk areas?

@richierocks

This comment has been minimized.

Contributor

richierocks commented Jun 13, 2015

sanitise_dim roxygen comments are now @nord, I've removed half the unit tests, and both the code and tests are now in the house style.

sanitise_dim <- function(n)
{
xname <- sQuote(deparse(substitute(n)))
if (length(n) == 0)

This comment has been minimized.

@hadley

hadley Jun 15, 2015

Member

{ shouldn't be on a new line

@hadley hadley merged commit 406982e into tidyverse:master Jun 18, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@hadley

This comment has been minimized.

Member

hadley commented Jun 18, 2015

Fixed by hand. Thanks for the patch!

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