Skip to content
Browse files

Don't run examples of deprecated functions

  • Loading branch information...
1 parent b138312 commit 5677ca79003c9855ec66c3f592accc6eb934acb6 @wch wch committed Jul 27, 2012
Showing with 26 additions and 6 deletions.
  1. +8 −0 R/templates.r
  2. +5 −3 R/theme.r
  3. +2 −0 man/ggfluctuation.Rd
  4. +2 −0 man/ggmissing.Rd
  5. +2 −0 man/ggpcp.Rd
  6. +2 −0 man/ggstructure.Rd
  7. +5 −3 man/update_element.Rd
View
8 R/templates.r
@@ -14,13 +14,15 @@
#' @param ... other arguments passed on plot creation
#' @export
#' @examples
+#' \dontrun{
#' ggpcp(mtcars) + geom_line()
#' ggpcp(mtcars, vars=names(mtcars[2:6])) + geom_line()
#' ggpcp(mtcars) + geom_boxplot(aes(group=variable))
#'
#' p <- ggpcp(mtcars, vars=names(mtcars[2:6]))
#' p + geom_line()
#' p + geom_line(aes(colour=mpg))
+#' }
ggpcp <- function(data, vars=names(data), ...) {
.Deprecated()
scaled <- as.data.frame(lapply(data[, vars], rescale01))
@@ -51,10 +53,12 @@ ggpcp <- function(data, vars=names(data), ...) {
#' @param na.rm If \code{TRUE}, silently remove missing values.
#' @export
#' @examples
+#' \dontrun{
#' ggfluctuation(table(movies$Action, movies$Comedy))
#' ggfluctuation(table(movies$Action, movies$mpaa))
#' ggfluctuation(table(movies$Action, movies$Comedy), type="colour")
#' ggfluctuation(table(warpbreaks$breaks, warpbreaks$tension))
+#' }
ggfluctuation <- function(table, type="size", floor=0, ceiling=max(table$freq, na.rm=TRUE)) {
.Deprecated()
if (is.table(table)) table <- as.data.frame(t(table))
@@ -118,11 +122,13 @@ ggfluctuation <- function(table, type="size", floor=0, ceiling=max(table$freq, n
#' @seealso \code{\link{ggstructure}}, \code{\link{ggorder}}
#' @export
#' @examples
+#' \dontrun{
#' mmissing <- movies
#' mmissing[sample(nrow(movies), 1000), sample(ncol(movies), 5)] <- NA
#' ggmissing(mmissing)
#' ggmissing(mmissing, order=FALSE, missing.only = FALSE)
#' ggmissing(mmissing, avoid="dodge") + scale_y_sqrt()
+#' }
ggmissing <- function(data, avoid="stack", order=TRUE, missing.only = TRUE) {
.Deprecated()
missings <- mapply(function(var, name) cbind(as.data.frame(table(missing=factor(is.na(var), levels=c(TRUE, FALSE), labels=c("yes", "no")))), variable=name),
@@ -152,7 +158,9 @@ ggmissing <- function(data, avoid="stack", order=TRUE, missing.only = TRUE) {
#' @param data data set to plot
#' @export
#' @examples
+#' \dontrun{
#' ggstructure(mtcars)
+#' }
ggstructure <- function(data) {
.Deprecated()
ggpcp(data) +
View
8 R/theme.r
@@ -490,21 +490,23 @@ update_theme <- function(oldtheme, newtheme) {
##' @seealso \code{\link{\%+replace\%}} and \code{\link{+.gg}}
##' @export
##' @examples
+##' \dontrun{
##' x <- element_text(size = 15)
##' update_element(x, colour = "red")
##' # Partial matching works
##' update_element(x, col = "red")
##' # So does positional
##' update_element(x, "Times New Roman")
##' # And it throws an error if you use an argument that doesn't exist
-##' \donttest{update_element(x, noargument = 12)}
+##' update_element(x, noargument = 12)
##' # Or multiple arguments with the same name
-##' \donttest{update_element(x, size = 12, size = 15)}
+##' update_element(x, size = 12, size = 15)
##'
##' # Will look up element if given name
##' update_element("axis.text.x", colour = 20)
##' # Throws error if incorrectly named
-##' \donttest{update_element("axis.text", colour = 20)}
+##' update_element("axis.text", colour = 20)
+##' }
update_element <- function(name, ...) {
.Deprecated(new = "+.gg")
if (is.character(name)) {
View
2 man/ggfluctuation.Rd
@@ -31,9 +31,11 @@
to sqrt(count)).
}
\examples{
+\dontrun{
ggfluctuation(table(movies$Action, movies$Comedy))
ggfluctuation(table(movies$Action, movies$mpaa))
ggfluctuation(table(movies$Action, movies$Comedy), type="colour")
ggfluctuation(table(warpbreaks$breaks, warpbreaks$tension))
}
+}
View
2 man/ggmissing.Rd
@@ -26,12 +26,14 @@
copied from.
}
\examples{
+\dontrun{
mmissing <- movies
mmissing[sample(nrow(movies), 1000), sample(ncol(movies), 5)] <- NA
ggmissing(mmissing)
ggmissing(mmissing, order=FALSE, missing.only = FALSE)
ggmissing(mmissing, avoid="dodge") + scale_y_sqrt()
}
+}
\seealso{
\code{\link{ggstructure}}, \code{\link{ggorder}}
}
View
2 man/ggpcp.Rd
@@ -26,6 +26,7 @@
shown in the example.
}
\examples{
+\dontrun{
ggpcp(mtcars) + geom_line()
ggpcp(mtcars, vars=names(mtcars[2:6])) + geom_line()
ggpcp(mtcars) + geom_boxplot(aes(group=variable))
@@ -34,4 +35,5 @@ p <- ggpcp(mtcars, vars=names(mtcars[2:6]))
p + geom_line()
p + geom_line(aes(colour=mpg))
}
+}
View
2 man/ggstructure.Rd
@@ -12,6 +12,8 @@
the data.
}
\examples{
+\dontrun{
ggstructure(mtcars)
}
+}
View
8 man/update_element.Rd
@@ -20,21 +20,23 @@
\code{\link{\%+replace\%}} or \code{\link{+.gg}} instead.
}
\examples{
+\dontrun{
x <- element_text(size = 15)
update_element(x, colour = "red")
# Partial matching works
update_element(x, col = "red")
# So does positional
update_element(x, "Times New Roman")
# And it throws an error if you use an argument that doesn't exist
-\donttest{update_element(x, noargument = 12)}
+update_element(x, noargument = 12)
# Or multiple arguments with the same name
-\donttest{update_element(x, size = 12, size = 15)}
+update_element(x, size = 12, size = 15)
# Will look up element if given name
update_element("axis.text.x", colour = 20)
# Throws error if incorrectly named
-\donttest{update_element("axis.text", colour = 20)}
+update_element("axis.text", colour = 20)
+}
}
\seealso{
\code{\link{\%+replace\%}} and \code{\link{+.gg}}

2 comments on commit 5677ca7

@dlebauer

how should documentation of deprecated functions be treated? should documentation be removed? e.g. there is a link from http://docs.ggplot2.org/current/ to ggstructure, and the ggstructure help http://docs.ggplot2.org/current/ggstructure.html does not indicate that the function is deprecated.

@BrianDiggs

Perhaps there should also be

#' @rdname ggplot2-deprecated

added to the roxygen documentation. This should be true for anything that calles gg_dep.

Please sign in to comment.
Something went wrong with that request. Please try again.