Skip to content

Commit d95ed55

Browse files
committed
Fix examples for R CMD check --run-donttest
1 parent d0bf588 commit d95ed55

File tree

8 files changed

+18
-6
lines changed

8 files changed

+18
-6
lines changed

R/annotation-custom.r

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@ NULL
2424
#' # Dummy plot
2525
#' base <- qplot(1:10, 1:10, geom = "blank") + theme_bw()
2626
#' # Adding a table
27-
#' \donttest{if (require(gridExtra)) {
27+
#' \dontrun{
28+
#' if (require(gridExtra)) {
2829
#' base + annotation_custom(grob = tableGrob(head(iris[ ,1:3])),
2930
#' xmin = 3, xmax = 6, ymin = 2, ymax = 8)
3031
#' # full panel
3132
#' base + annotation_custom(grob = roundrectGrob(),
3233
#' xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf)
33-
#' }}
34+
#' }
35+
#' }
3436
#' # Inset plot
3537
#' g <- ggplotGrob(qplot(1, 1) +
3638
#' theme(plot.background = element_rect(colour = "black")))

R/stat-smooth.r

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@
8484
#'
8585
#' # Use qplot instead
8686
#' qplot(qsec, wt, data=mtcars, geom=c("smooth", "point"))
87+
#' }
8788
#'
89+
#' \dontrun{
8890
#' # Example with logistic regression
8991
#' data("kyphosis", package="rpart")
9092
#' qplot(Age, Kyphosis, data=kyphosis)

R/theme.r

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,9 @@ print.theme <- function(x, ...) str(x)
286286
#' mytheme <- theme_grey() + theme(plot.title = element_text(colour = "red"))
287287
#' p + mytheme
288288
#'
289+
#' }
289290
#'
291+
#' \dontrun{
290292
#' ## Run this to generate a graph of the element inheritance tree
291293
#' build_element_graph <- function(tree) {
292294
#' require(igraph)

R/translate-qplot-lattice.r

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#'
77
#' @name translate_qplot_lattice
88
#' @examples
9-
#' \donttest{
9+
#' \dontrun{
1010
#' library(lattice)
1111
#'
1212
#' xyplot(rating ~ year, data=movies)

man/annotation_custom.Rd

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,15 @@ Inf values can be used to fill the full plot panel (see examples).
3535
# Dummy plot
3636
base <- qplot(1:10, 1:10, geom = "blank") + theme_bw()
3737
# Adding a table
38-
\donttest{if (require(gridExtra)) {
38+
\dontrun{
39+
if (require(gridExtra)) {
3940
base + annotation_custom(grob = tableGrob(head(iris[ ,1:3])),
4041
xmin = 3, xmax = 6, ymin = 2, ymax = 8)
4142
# full panel
4243
base + annotation_custom(grob = roundrectGrob(),
4344
xmin = -Inf, xmax = Inf, ymin = -Inf, ymax = Inf)
44-
}}
45+
}
46+
}
4547
# Inset plot
4648
g <- ggplotGrob(qplot(1, 1) +
4749
theme(plot.background = element_rect(colour = "black")))

man/stat_smooth.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ c + stat_smooth(method=lm, fullrange=TRUE, alpha = 0.1) + geom_point()
112112

113113
# Use qplot instead
114114
qplot(qsec, wt, data=mtcars, geom=c("smooth", "point"))
115+
}
115116

117+
\dontrun{
116118
# Example with logistic regression
117119
data("kyphosis", package="rpart")
118120
qplot(Age, Kyphosis, data=kyphosis)

man/theme.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,9 @@ k + theme(panel.margin.y = unit(0, "lines"))
250250
mytheme <- theme_grey() + theme(plot.title = element_text(colour = "red"))
251251
p + mytheme
252252

253+
}
253254

255+
\dontrun{
254256
## Run this to generate a graph of the element inheritance tree
255257
build_element_graph <- function(tree) {
256258
require(igraph)

man/translate_qplot_lattice.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface. ggplot2 does not because the formula does not generalise well
99
to more complicated situations.
1010
}
1111
\examples{
12-
\donttest{
12+
\dontrun{
1313
library(lattice)
1414

1515
xyplot(rating ~ year, data=movies)

0 commit comments

Comments
 (0)