Permalink
Browse files

Style fixes suggested by winston

  • Loading branch information...
1 parent f74891c commit 67441843dc078e2ec0222ba33e9351e732553655 @jimhester jimhester committed Oct 11, 2012
Showing with 9 additions and 4 deletions.
  1. +1 −1 R/limits.r
  2. +8 −3 R/scale-.r
View
@@ -47,7 +47,7 @@ limits <- function(lims, var) UseMethod("limits")
#' @export
limits.numeric <- function(lims, var) {
stopifnot(length(lims) == 2)
- if (sum(is.na(lims)) == 0 &lims[1] > lims[2]) {
+ if (!any(is.na(lims)) && lims[1] > lims[2]) {
trans <- "reverse"
} else {
trans <- "identity"
View
@@ -296,11 +296,16 @@ scale_limits <- function(scale) {
}
+# if scale contains a NULL, use the default scale range
+# if scale contains a NA, use the default range for that axis, otherwise
+# use the user defined limit for that axis
#' @export
scale_limits.default <- function(scale) {
- if(!is.null(scale$limits))
- ifelse(!is.na(scale$limits),scale$limits,scale$range$range)
- else scale$range$range
+ if(!is.null(scale$limits)) {
+ ifelse(!is.na(scale$limits), scale$limits, scale$range$range)
+ } else {
+ scale$range$range
+ }
}
# @kohske

0 comments on commit 6744184

Please sign in to comment.