Skip to content

Commit

Permalink
Update stat_bin message
Browse files Browse the repository at this point in the history
  • Loading branch information
wch committed Sep 25, 2012
1 parent cf89ea4 commit 50639e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion R/geom-bar-.r
Expand Up @@ -9,7 +9,7 @@
#' example.
#'
#' The heights of the bars commonly represent one of two things: either a
#' count of cases in each group, the values in a column of the data frame.
#' count of cases in each group, or the values in a column of the data frame.
#' By default, \code{geom_bar} uses \code{stat="bin"}. This makes the height
#' of each bar equal to the number of cases in each group, and it is
#' incompatible with mapping values to the \code{y} aesthetic. If you want
Expand Down
15 changes: 6 additions & 9 deletions R/stat-bin.r
Expand Up @@ -57,15 +57,12 @@ StatBin <- proto(Stat, {
calculate_groups <- function(., data, ...) {
if (!is.null(data$y) || !is.null(match.call()$y)) {
# Deprecate this behavior
message("Mapping a variable to y and also using stat=\"bin\". ",
"With stat=\"bin\", it will attempt to set the y value to the count ",
"of cases in each group. ",
"This can result in unexpected behavior and will not be allowed in a ",
"future version of ggplot2. ",
"If you want y to represent counts of cases, use stat=\"bin\" and ",
"don't map a variable to y. ",
"If you want y to represent values in the data, use ",
"stat=\"identity\". See ?geom_bar for examples.")
message("Mapping a variable to y and also using stat=\"bin\".\n",
" With stat=\"bin\", it will attempt to set the y value to the count of cases in each group.\n",
" This can result in unexpected behavior and will not be allowed in a future version of ggplot2.\n",
" If you want y to represent counts of cases, use stat=\"bin\" and don't map a variable to y.\n",
" If you want y to represent values in the data, use stat=\"identity\".\n",
" See ?geom_bar for examples.")
}

.$informed <- FALSE
Expand Down

0 comments on commit 50639e5

Please sign in to comment.