Skip to content

Commit 87d9a62

Browse files
committed
Suppress warnings when generating help
1 parent ea635da commit 87d9a62

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

R/utilities-help.r

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
aesthetics <- function(x) {
2-
req_aes <- x$required_aes
3-
def_aes <- names(x$default_aes())
4-
def_aes <- setdiff(def_aes, req_aes)
5-
if (length(req_aes) == 0){
6-
return(sort(names(x$default_aes())))
7-
}
8-
if (length(def_aes) == 0){
9-
return(paste("\\strong{", sort(x$required_aes), "}",sep = ""))
10-
}
11-
return(c(paste("\\strong{",sort(x$required_aes), "}", sep = ""), sort(def_aes)))
2+
req_aes <- x$required_aes
3+
def_aes <- names(x$default_aes())
4+
def_aes <- setdiff(def_aes, req_aes)
5+
if (length(req_aes) == 0){
6+
# Suppress warnings which occur when sorting NULL
7+
return(suppressWarnings(sort(names(x$default_aes()))))
8+
}
9+
if (length(def_aes) == 0){
10+
return(paste("\\strong{", sort(x$required_aes), "}",sep = ""))
11+
}
12+
return(c(paste("\\strong{", sort(x$required_aes), "}", sep = ""), sort(def_aes)))
1213
}
1314
geom_aesthetics <- function(x) {
1415
aesthetics(Geom$find(x))
@@ -20,10 +21,10 @@ stat_aesthetics <- function(x) {
2021
rd_aesthetics <- function(type, name) {
2122
obj <- get(firstUpper(type))
2223
aes <- aesthetics(obj$find(name))
23-
24-
paste("\\code{", type, "_", name, "} ",
25-
"understands the following aesthetics (required aesthetics are in bold):\n\n",
24+
25+
paste("\\code{", type, "_", name, "} ",
26+
"understands the following aesthetics (required aesthetics are in bold):\n\n",
2627
"\\itemize{\n",
2728
paste(" \\item \\code{", aes, "}", collapse = "\n", sep = ""),
2829
"\n}\n", sep = "")
29-
}
30+
}

0 commit comments

Comments
 (0)