1
1
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 )))
12
13
}
13
14
geom_aesthetics <- function (x ) {
14
15
aesthetics(Geom $ find(x ))
@@ -20,10 +21,10 @@ stat_aesthetics <- function(x) {
20
21
rd_aesthetics <- function (type , name ) {
21
22
obj <- get(firstUpper(type ))
22
23
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 " ,
26
27
" \\ itemize{\n " ,
27
28
paste(" \\ item \\ code{" , aes , " }" , collapse = " \n " , sep = " " ),
28
29
" \n }\n " , sep = " " )
29
- }
30
+ }
0 commit comments