Skip to content

Commit 308d77a

Browse files
committed
gg_dep: export and add help
1 parent a57b55b commit 308d77a

File tree

3 files changed

+64
-6
lines changed

3 files changed

+64
-6
lines changed

NAMESPACE

+1
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ export(geom_text)
246246
export(geom_tile)
247247
export(geom_violin)
248248
export(geom_vline)
249+
export(gg_dep)
249250
export(ggfluctuation)
250251
export(ggmissing)
251252
export(ggorder)

R/utilities.r

+25-6
Original file line numberDiff line numberDiff line change
@@ -197,16 +197,35 @@ if (packageVersion("plyr") <= package_version("1.7.1")) {
197197
}
198198

199199

200-
# Give a deprecation error, warning, or messsage, depending on version number.
201-
#
202-
# @param version The _last_ version of ggplot2 where this function was good
203-
# (in other words, the last version where it was not deprecated).
204-
# @param message The message to print
200+
#' Give a deprecation error, warning, or messsage, depending on version number.
201+
#'
202+
#' Version numbers have the format <major>.<minor>.<subminor>, like 0.9.2.
203+
#' This function compares the current version number of ggplot2 against the
204+
#' specified \code{version}, which is the most recent version before the
205+
#' function (or other object) was deprecated.
206+
#'
207+
#' \code{gg_dep} will give an error, warning, or message, depending on the
208+
#' difference between the current ggplot2 version and the specified
209+
#' \code{version}.
210+
#'
211+
#' If the current major number is greater than \code{version}'s major number,
212+
#' or if the current minor number is more than 1 greater than \code{version}'s
213+
#' minor number, give an error.
214+
#'
215+
#' If the current minor number differs from \code{version}'s minor number by
216+
#' one, give a warning.
217+
#'
218+
#' If the current subminor number differs from \code{version}'s subminor
219+
#' number, print a message.
220+
#'
221+
#' @param version The last version of ggplot2 where this function was good
222+
#' (in other words, the last version where it was not deprecated).
223+
#' @param message The message to print.
224+
#' @export
205225
gg_dep <- function(version, msg) {
206226
v <- as.package_version(version)
207227
cv <- packageVersion("ggplot2")
208228

209-
# Version number is major.minor.subminor, like 0.9.2
210229
# If current major number is greater than last-good major number, or if
211230
# current minor number is more than 1 greater than last-good minor number,
212231
# give error.

man/gg_dep.Rd

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
\name{gg_dep}
2+
\alias{gg_dep}
3+
\title{Give a deprecation error, warning, or messsage, depending on version number.}
4+
\usage{
5+
gg_dep(version, msg)
6+
}
7+
\arguments{
8+
\item{version}{The last version of ggplot2 where this
9+
function was good (in other words, the last version where
10+
it was not deprecated).}
11+
12+
\item{message}{The message to print.}
13+
}
14+
\description{
15+
Version numbers have the format
16+
<major>.<minor>.<subminor>, like 0.9.2. This function
17+
compares the current version number of ggplot2 against
18+
the specified \code{version}, which is the most recent
19+
version before the function (or other object) was
20+
deprecated.
21+
}
22+
\details{
23+
\code{gg_dep} will give an error, warning, or message,
24+
depending on the difference between the current ggplot2
25+
version and the specified \code{version}.
26+
27+
If the current major number is greater than
28+
\code{version}'s major number, or if the current minor
29+
number is more than 1 greater than \code{version}'s minor
30+
number, give an error.
31+
32+
If the current minor number differs from \code{version}'s
33+
minor number by one, give a warning.
34+
35+
If the current subminor number differs from
36+
\code{version}'s subminor number, print a message.
37+
}
38+

0 commit comments

Comments
 (0)