Permalink
Browse files

gg_dep: export and add help

  • Loading branch information...
wch committed Oct 24, 2012
1 parent a57b55b commit 308d77ab13cb7cbd59f5a68a128a53e4e9d09f2e
Showing with 64 additions and 6 deletions.
  1. +1 −0 NAMESPACE
  2. +25 −6 R/utilities.r
  3. +38 −0 man/gg_dep.Rd
View
@@ -246,6 +246,7 @@ export(geom_text)
export(geom_tile)
export(geom_violin)
export(geom_vline)
+export(gg_dep)
export(ggfluctuation)
export(ggmissing)
export(ggorder)
View
@@ -197,16 +197,35 @@ if (packageVersion("plyr") <= package_version("1.7.1")) {
}
-# Give a deprecation error, warning, or messsage, depending on version number.
-#
-# @param version The _last_ version of ggplot2 where this function was good
-# (in other words, the last version where it was not deprecated).
-# @param message The message to print
+#' Give a deprecation error, warning, or messsage, depending on version number.
+#'
+#' Version numbers have the format <major>.<minor>.<subminor>, like 0.9.2.
+#' This function compares the current version number of ggplot2 against the
+#' specified \code{version}, which is the most recent version before the
+#' function (or other object) was deprecated.
+#'
+#' \code{gg_dep} will give an error, warning, or message, depending on the
+#' difference between the current ggplot2 version and the specified
+#' \code{version}.
+#'
+#' If the current major number is greater than \code{version}'s major number,
+#' or if the current minor number is more than 1 greater than \code{version}'s
+#' minor number, give an error.
+#'
+#' If the current minor number differs from \code{version}'s minor number by
+#' one, give a warning.
+#'
+#' If the current subminor number differs from \code{version}'s subminor
+#' number, print a message.
+#'
+#' @param version The last version of ggplot2 where this function was good
+#' (in other words, the last version where it was not deprecated).
+#' @param message The message to print.
+#' @export
gg_dep <- function(version, msg) {
v <- as.package_version(version)
cv <- packageVersion("ggplot2")
- # Version number is major.minor.subminor, like 0.9.2
# If current major number is greater than last-good major number, or if
# current minor number is more than 1 greater than last-good minor number,
# give error.
View
@@ -0,0 +1,38 @@
+\name{gg_dep}
+\alias{gg_dep}
+\title{Give a deprecation error, warning, or messsage, depending on version number.}
+\usage{
+ gg_dep(version, msg)
+}
+\arguments{
+ \item{version}{The last version of ggplot2 where this
+ function was good (in other words, the last version where
+ it was not deprecated).}
+
+ \item{message}{The message to print.}
+}
+\description{
+ Version numbers have the format
+ <major>.<minor>.<subminor>, like 0.9.2. This function
+ compares the current version number of ggplot2 against
+ the specified \code{version}, which is the most recent
+ version before the function (or other object) was
+ deprecated.
+}
+\details{
+ \code{gg_dep} will give an error, warning, or message,
+ depending on the difference between the current ggplot2
+ version and the specified \code{version}.
+
+ If the current major number is greater than
+ \code{version}'s major number, or if the current minor
+ number is more than 1 greater than \code{version}'s minor
+ number, give an error.
+
+ If the current minor number differs from \code{version}'s
+ minor number by one, give a warning.
+
+ If the current subminor number differs from
+ \code{version}'s subminor number, print a message.
+}
+

0 comments on commit 308d77a

Please sign in to comment.