Skip to content

Commit 66b81e9

Browse files
committed
stat_bin: fix documentation for 'right' argument
1 parent b316892 commit 66b81e9

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

R/stat-bin.r

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#' @param origin Origin of first bin
1313
#' @param width Width of bars when used with categorical data
1414
#' @param right If \code{TRUE}, right-closed, left-open, if \code{FALSE},
15-
#" the default, right-open, left-closed.
15+
#' the default, right-open, left-closed.
1616
#' @param drop If TRUE, remove all bins with zero counts
1717
#' @return New data frame with additional columns:
1818
#' \item{count}{number of points in bin}
@@ -24,10 +24,10 @@
2424
#' \donttest{
2525
#' simple <- data.frame(x = rep(1:10, each = 2))
2626
#' base <- ggplot(simple, aes(x))
27-
#' # By default, right = TRUE, and intervals are of the form (a, b]
28-
#' base + stat_bin(binwidth = 1, drop = FALSE, right = TRUE, col = "black")
29-
#' # If right = FALSE intervals are of the form [a, b)
27+
#' # By default, right = FALSE intervals are of the form [a, b)
3028
#' base + stat_bin(binwidth = 1, drop = FALSE, right = FALSE, col = "black")
29+
#' # If right = TRUE, and intervals are of the form (a, b]
30+
#' base + stat_bin(binwidth = 1, drop = FALSE, right = TRUE, col = "black")
3131
#'
3232
#' m <- ggplot(movies, aes(x=rating))
3333
#' m + stat_bin()

man/stat_bin.Rd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
data}
2121

2222
\item{right}{If \code{TRUE}, right-closed, left-open, if
23-
\code{FALSE},}
23+
\code{FALSE}, the default, right-open, left-closed.}
2424

2525
\item{drop}{If TRUE, remove all bins with zero counts}
2626

@@ -60,10 +60,10 @@
6060
\donttest{
6161
simple <- data.frame(x = rep(1:10, each = 2))
6262
base <- ggplot(simple, aes(x))
63-
# By default, right = TRUE, and intervals are of the form (a, b]
64-
base + stat_bin(binwidth = 1, drop = FALSE, right = TRUE, col = "black")
65-
# If right = FALSE intervals are of the form [a, b)
63+
# By default, right = FALSE intervals are of the form [a, b)
6664
base + stat_bin(binwidth = 1, drop = FALSE, right = FALSE, col = "black")
65+
# If right = TRUE, and intervals are of the form (a, b]
66+
base + stat_bin(binwidth = 1, drop = FALSE, right = TRUE, col = "black")
6767

6868
m <- ggplot(movies, aes(x=rating))
6969
m + stat_bin()

0 commit comments

Comments
 (0)