Skip to content

Commit

Permalink
Suppress warnings when generating help
Browse files Browse the repository at this point in the history
  • Loading branch information
wch committed Mar 1, 2013
1 parent ea635da commit 87d9a62
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions R/utilities-help.r
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
aesthetics <- function(x) {
req_aes <- x$required_aes
def_aes <- names(x$default_aes())
def_aes <- setdiff(def_aes, req_aes)
if (length(req_aes) == 0){
return(sort(names(x$default_aes())))
}
if (length(def_aes) == 0){
return(paste("\\strong{", sort(x$required_aes), "}",sep = ""))
}
return(c(paste("\\strong{",sort(x$required_aes), "}", sep = ""), sort(def_aes)))
req_aes <- x$required_aes
def_aes <- names(x$default_aes())
def_aes <- setdiff(def_aes, req_aes)
if (length(req_aes) == 0){
# Suppress warnings which occur when sorting NULL
return(suppressWarnings(sort(names(x$default_aes()))))
}
if (length(def_aes) == 0){
return(paste("\\strong{", sort(x$required_aes), "}",sep = ""))
}
return(c(paste("\\strong{", sort(x$required_aes), "}", sep = ""), sort(def_aes)))
}
geom_aesthetics <- function(x) {
aesthetics(Geom$find(x))
Expand All @@ -20,10 +21,10 @@ stat_aesthetics <- function(x) {
rd_aesthetics <- function(type, name) {
obj <- get(firstUpper(type))
aes <- aesthetics(obj$find(name))
paste("\\code{", type, "_", name, "} ",
"understands the following aesthetics (required aesthetics are in bold):\n\n",

paste("\\code{", type, "_", name, "} ",
"understands the following aesthetics (required aesthetics are in bold):\n\n",
"\\itemize{\n",
paste(" \\item \\code{", aes, "}", collapse = "\n", sep = ""),
"\n}\n", sep = "")
}
}

0 comments on commit 87d9a62

Please sign in to comment.