Skip to content

Commit ee5fc6e

Browse files
committed
Fix all donttest problems
1 parent 9b5e097 commit ee5fc6e

File tree

8 files changed

+22
-361
lines changed

8 files changed

+22
-361
lines changed

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ Collate:
198198
'theme-defaults.r'
199199
'theme-elements.r'
200200
'theme.r'
201-
'translate-qplot-base.r'
202201
'translate-qplot-ggplot.r'
203202
'translate-qplot-lattice.r'
204203
'utilities-break.r'

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Bug fixes and minor improvements
44

5+
* All `\donttest{}` examples run.
6+
57
* Removed a superfluous comma in `theme-defaults.r` code (@jschoeley)
68

79
* Fixed a compatibility issue with `ggproto` and R versions prior to 3.1.2.

R/scale-discrete-.r

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
#' @rdname scale_discrete
1616
#' @export
1717
#' @examples
18-
#' \donttest{
19-
#' ggplot(diamonds, aes(cut)) + stat_bin()
2018
#' ggplot(diamonds, aes(cut)) + geom_bar()
2119
#'
20+
#' \donttest{
2221
#' # The discrete position scale is added automatically whenever you
2322
#' # have a discrete position.
2423
#'
@@ -29,9 +28,6 @@
2928
#' d + scale_x_discrete("Cut", labels = c("Fair" = "F","Good" = "G",
3029
#' "Very Good" = "VG","Perfect" = "P","Ideal" = "I"))
3130
#'
32-
#' d + scale_y_discrete("Clarity")
33-
#' d + scale_x_discrete("Cut") + scale_y_discrete("Clarity")
34-
#'
3531
#' # Use limits to adjust the which levels (and in what order)
3632
#' # are displayed
3733
#' d + scale_x_discrete(limits=c("Fair","Ideal"))

R/stat-summary.r

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -47,27 +47,18 @@
4747
#'
4848
#' # You can supply individual functions to summarise the value at
4949
#' # each x:
50-
#' d + stat_summary(fun.y = "median", colour = "red", size = 2)
51-
#' d + stat_summary(fun.y = "mean", colour = "red", size = 2)
50+
#' d + stat_summary(fun.y = "median", colour = "red", size = 2, geom = "point")
51+
#' d + stat_summary(fun.y = "mean", colour = "red", size = 2, geom = "point")
5252
#' d + aes(colour = factor(vs)) + stat_summary(fun.y = mean, geom="line")
5353
#'
5454
#' d + stat_summary(fun.y = mean, fun.ymin = min, fun.ymax = max,
5555
#' colour = "red")
5656
#'
57-
#' #' d <- ggplot(diamonds, aes(carat, price))
58-
#' d + geom_smooth()
59-
#' d + geom_line(stat = "summary_bin", binwidth = 0.1, fun.y = "mean")
60-
#'
6157
#' d <- ggplot(diamonds, aes(cut))
6258
#' d + geom_bar()
6359
#' d + stat_summary_bin(aes(y = price), fun.y = "mean", geom = "bar")
64-
65-
#' \donttest{
66-
#' # A set of useful summary functions is provided from the Hmisc package:
67-
#' stat_sum_df <- function(fun, geom="crossbar", ...) {
68-
#' stat_summary(fun.data=fun, colour="red", geom=geom, width=0.2, ...)
69-
#' }
7060
#'
61+
#' \donttest{
7162
#' # Don't use ylim to zoom into a summary plot - this throws the
7263
#' # data away
7364
#' p <- ggplot(mtcars, aes(cyl, mpg)) +
@@ -77,28 +68,18 @@
7768
#' # Instead use coord_cartesian
7869
#' p + coord_cartesian(ylim = c(15, 30))
7970
#'
71+
#' # A set of useful summary functions is provided from the Hmisc package:
72+
#' stat_sum_df <- function(fun, geom="crossbar", ...) {
73+
#' stat_summary(fun.data=fun, colour="red", geom=geom, width=0.2, ...)
74+
#' }
75+
#' d <- ggplot(mtcars, aes(cyl, mpg)) + geom_point()
8076
#' # The crossbar geom needs grouping to be specified when used with
8177
#' # a continuous x axis.
8278
#' d + stat_sum_df("mean_cl_boot", mapping = aes(group = cyl))
8379
#' d + stat_sum_df("mean_sdl", mapping = aes(group = cyl))
84-
#' d + stat_sum_df("mean_sdl", mult = 1, mapping = aes(group = cyl))
80+
#' d + stat_sum_df("mean_sdl", fun.args = list(mult = 1), mapping = aes(group = cyl))
8581
#' d + stat_sum_df("median_hilow", mapping = aes(group = cyl))
8682
#'
87-
#' # There are lots of different geoms you can use to display the summaries
88-
#'
89-
#' d + stat_sum_df("mean_cl_normal", mapping = aes(group = cyl))
90-
#' d + stat_sum_df("mean_cl_normal", geom = "errorbar")
91-
#' d + stat_sum_df("mean_cl_normal", geom = "pointrange")
92-
#' d + stat_sum_df("mean_cl_normal", geom = "smooth")
93-
#'
94-
#' # Summaries are more useful with a bigger data set:
95-
#' mpg2 <- subset(mpg, cyl != 5L)
96-
#' m <- ggplot(mpg2, aes(x=cyl, y=hwy)) +
97-
#' geom_point() +
98-
#' stat_summary(fun.data = "mean_sdl", geom = "linerange",
99-
#' colour = "red", size = 2, mult = 1) +
100-
#' xlab("cyl")
101-
#' m
10283
#' # An example with highly skewed distributions:
10384
#' if (require("ggplot2movies")) {
10485
#' set.seed(596)

R/translate-qplot-base.r

Lines changed: 0 additions & 145 deletions
This file was deleted.

man/scale_discrete.Rd

Lines changed: 1 addition & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/stat_summary.Rd

Lines changed: 9 additions & 27 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)