Skip to content

Commit

Permalink
Fix bug in aesthetics shown by GeomBoxplot and StatBoxplot
Browse files Browse the repository at this point in the history
When a default was a derived variable (..count..), eval
could not be called on it, so only call eval on those that
are actually calls.
  • Loading branch information
BrianDiggs committed Jan 14, 2013
1 parent 18bac81 commit 551fc5a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions R/utilities-help.r
Expand Up @@ -5,7 +5,7 @@
## \describe{
## \item{aesthetic}{The name of the aesthetic, as a charater string}
## \item{required}{Is the aesthetic requried, as a logical}
## \item{default}{A list of the default values}
## \item{default}{A list of the default values expressed as character}
## }
## The \code{data.frame} is sorted with the requried aesthetics first
## and alphabetically by aesthetic name within that.
Expand All @@ -16,7 +16,9 @@ aesthetics <- function(x) {
stringsAsFactors = FALSE)
allowed_aes$required <- rep(FALSE, nrow(allowed_aes))
allowed_aes$required[allowed_aes$aesthetic %in% req_aes] <- TRUE
allowed_aes$default <- lapply(def_aes, eval)[allowed_aes$aesthetic]
calls <- vapply(def_aes, is.call, logical(1))
def_aes[calls] <- lapply(def_aes[calls], eval)
allowed_aes$default <- lapply(def_aes[allowed_aes$aesthetic], as.character)
allowed_aes[order(!allowed_aes$required, allowed_aes$aesthetic),]
}

Expand Down

0 comments on commit 551fc5a

Please sign in to comment.