Skip to content

Commit

Permalink
Fix documentation cross-refs.
Browse files Browse the repository at this point in the history
Includes exporting and documenting layer and waiver
  • Loading branch information
hadley committed Dec 20, 2011
1 parent f47bffa commit 08461b8
Show file tree
Hide file tree
Showing 21 changed files with 82 additions and 37 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Expand Up @@ -81,6 +81,7 @@ export(label_parsed)
export(label_value)
export(labs)
export(last_plot)
export(layer)
export(map_data)
export(mean_cl_boot)
export(mean_cl_normal)
Expand Down Expand Up @@ -194,6 +195,7 @@ export(theme_text)
export(theme_update)
export(update_element)
export(update_labels)
export(waiver)
export(xlab)
export(xlim)
export(ylab)
Expand Down
7 changes: 4 additions & 3 deletions R/coord-map.r
Expand Up @@ -7,9 +7,10 @@
#' a better (or more correct) way to do this, please let me know
#'
#' @export
#' @param projection projection to use, see \code{\link{mapproject}} for
#' list
#' @param ... other arguments passed on to \code{\link{mapproject}}
#' @param projection projection to use, see
#' \code{\link[mapproj]{mapproject}} for list
#' @param ... other arguments passed on to
#' \code{\link[mapproj]{mapproject}}
#' @param orientation projection orientation, which defaults to
#' \code{c(90, 0, mean(range(x)))}. This is not optimal for many
#' projections, so you will have to supply your own.
Expand Down
15 changes: 8 additions & 7 deletions R/fortify-map.r
Expand Up @@ -5,7 +5,7 @@
#'
#' @method fortify map
#' @S3method fortify map
#' @seealso \code{\link{map_data}} and \code{\link{border}}
#' @seealso \code{\link{map_data}} and \code{\link{borders}}
#' @param model map object
#' @param data not used by this method
#' @param ... not used by this method
Expand Down Expand Up @@ -34,13 +34,14 @@ fortify.map <- function(model, data, ...) {

#' Create a data frame of map data.
#'
#' @param map name of map provided by \code{\link{maps}} package. These
#' include \code{\link{county}}, \code{\link{france}}, \code{\link{italy}},
#' \code{\link{nz}}, \code{\link{state}}, \code{\link{usa}},
#' \code{\link{world}}, \code{\link{world2}}.
#' @param map name of map provided by the \pkg{maps} package. These
#' include \code{\link[maps]{county}}, \code{\link[maps]{france}},
#' \code{\link[maps]{italy}}, \code{\link[maps]{nz}},
#' \code{\link[maps]{state}}, \code{\link[maps]{usa}},
#' \code{\link[maps]{world}}, \code{\link[maps]{world2}}.
#' @param region name of subregions to include. Defaults to \code{.} which
#' includes all subregion. See documentation for \code{\link{map}} for
#' more details.
#' includes all subregion. See documentation for \code{\link[maps]{map}}
#' for more details.
#' @param exact should the \code{region} be treated as a regular expression
#' (\code{FALSE}) or as a fixed string (\code{TRUE}).
#' @param ... all other arguments passed on to \code{\link[maps]{map}}
Expand Down
2 changes: 1 addition & 1 deletion R/fortify-multcomp.r
@@ -1,7 +1,7 @@
#' Fortify methods for objects produced by \pkg{multcomp}
#'
#' @param model an object of class \code{glht}, \code{confint.glht},
#' \code{summary.glht} or \code{\link{cld}}
#' \code{summary.glht} or \code{\link[multcomp]{cld}}
#' @param data,... other arguments to the generic ignored in this method.
#' @name fortify-multcomp
#' @examples
Expand Down
2 changes: 1 addition & 1 deletion R/guide-colorbar.r
Expand Up @@ -10,7 +10,7 @@
##'
##' @name guide_colorbar
##' @title Colorbar guide
##' @param title A character string or expression indicating a title of guide. If \code{NULL}, the title is not shown. By default (\code{\link{waiver()}}), the name of the scale object or tha name specified in \code{\link{labs}} is used for the title.
##' @param title A character string or expression indicating a title of guide. If \code{NULL}, the title is not shown. By default (\code{\link{waiver}}), the name of the scale object or tha name specified in \code{\link{labs}} is used for the title.
##' @param title.position A character string indicating the position of a title. One of "top" (default for a vertical guide), "bottom", "left" (default for a horizontal guide), or "right."
##' @param title.theme A theme object for rendering the title text. Usually the object of \code{\link{theme_text}} is expected. By default, the theme is specified by \code{legend.title} in \code{\link{opts}} or theme.
##' @param title.hjust A numeric specifying horizontal justification of the title text.
Expand Down
2 changes: 1 addition & 1 deletion R/guide-legend.r
Expand Up @@ -9,7 +9,7 @@
##'
##' @name guide_legend
##' @title Legend guide
##' @param title A character string or expression indicating a title of guide. If \code{NULL}, the title is not shown. By default (\code{\link{waiver()}}), the name of the scale object or tha name specified in \code{\link{labs}} is used for the title.
##' @param title A character string or expression indicating a title of guide. If \code{NULL}, the title is not shown. By default (\code{\link{waiver}}), the name of the scale object or tha name specified in \code{\link{labs}} is used for the title.
##' @param title.position A character string indicating the position of a title. One of "top" (default for a vertical guide), "bottom", "left" (default for a horizontal guide), or "right."
##' @param title.theme A theme object for rendering the title text. Usually the object of \code{\link{theme_text}} is expected. By default, the theme is specified by \code{legend.title} in \code{\link{opts}} or theme.
##' @param title.hjust A numeric specifying horizontal justification of the title text.
Expand Down
4 changes: 4 additions & 0 deletions R/layer.r
Expand Up @@ -231,6 +231,10 @@ Layer <- proto(expr = {
class <- function(.) "layer"
})

#' Create a new layer
#'
#' @keywords internal
#' @export
layer <- Layer$new

# Determine if aesthetic is calculated
Expand Down
2 changes: 1 addition & 1 deletion R/plot-construction.r
Expand Up @@ -15,7 +15,7 @@
#'
#' @param p plot object
#' @param object component to add
#' @seealso \code{\link{set_last_plot}}, \code{\link{ggplot}}
#' @seealso \code{\link{ggplot}}
#' @method + ggplot
#' @S3method "+" ggplot
#' @rdname ggplot-add
Expand Down
2 changes: 1 addition & 1 deletion R/plot-render.r
Expand Up @@ -151,7 +151,7 @@ ggplot_gtable <- function(data) {
#' @param x plot to display
#' @param newpage draw new (empty) page first?
#' @param vp viewport to draw plot in
#' @param ... other arguments passed on to \code{\link{ggplotGrob}}
#' @param ... other arguments not used by this method
#' @keywords hplot
#' @S3method print ggplot
#' @method print ggplot
Expand Down
11 changes: 10 additions & 1 deletion R/utilities.r
Expand Up @@ -165,8 +165,17 @@ should_stop <- function(expr) {
}


# Waive decision
#' A waiver object.
#'
#' A waiver is a "flag" object, similar to \code{NULL}, that indicates the
#' calling function should just use the default value. It is used in certain
#' functions to distinguish between displaying nothing (\code{NULL}) and
#' displaying a default value calculated elsewhere (\code{waiver()})
#'
#' @export
#' @keywords internal
waiver <- function() structure(NULL, class="waiver")

is.waive <- function(x) inherits(x, "waiver")


Expand Down
5 changes: 3 additions & 2 deletions man/borders.Rd
Expand Up @@ -22,8 +22,7 @@
Create a layer of map borders.
}
\examples{
require("maps")
require("ggplot2")
if (require("maps")) {

ia <- map_data("county", "iowa")
mid_range <- function(x) mean(range(x))
Expand All @@ -38,5 +37,7 @@ ggplot(capitals, aes(long, lat)) +
borders("state") +
geom_point(aes(size = pop)) +
scale_area()

}
}

4 changes: 2 additions & 2 deletions man/coord_map.Rd
Expand Up @@ -7,10 +7,10 @@
}
\arguments{
\item{projection}{projection to use, see
\code{\link{mapproject}} for list}
\code{\link[mapproj]{mapproject}} for list}

\item{...}{other arguments passed on to
\code{\link{mapproject}}}
\code{\link[mapproj]{mapproject}}}

\item{orientation}{projection orientation, which defaults
to \code{c(90, 0, mean(range(x)))}. This is not optimal
Expand Down
2 changes: 1 addition & 1 deletion man/fortify-multcomp.Rd
Expand Up @@ -17,7 +17,7 @@
\arguments{
\item{model}{an object of class \code{glht},
\code{confint.glht}, \code{summary.glht} or
\code{\link{cld}}}
\code{\link[multcomp]{cld}}}

\item{data,...}{other arguments to the generic ignored in
this method.}
Expand Down
2 changes: 1 addition & 1 deletion man/fortify.map.Rd
Expand Up @@ -28,6 +28,6 @@ qplot(long, lat, data = tx, geom = "polygon", group = group,
}
}
\seealso{
\code{\link{map_data}} and \code{\link{border}}
\code{\link{map_data}} and \code{\link{borders}}
}

2 changes: 1 addition & 1 deletion man/ggplot-add.Rd
Expand Up @@ -25,6 +25,6 @@
override current coordinate faceting }
}
\seealso{
\code{\link{set_last_plot}}, \code{\link{ggplot}}
\code{\link{ggplot}}
}

6 changes: 3 additions & 3 deletions man/guide_colorbar.Rd
Expand Up @@ -15,9 +15,9 @@
\arguments{
\item{title}{A character string or expression indicating
a title of guide. If \code{NULL}, the title is not shown.
By default (\code{\link{waiver()}}), the name of the
scale object or tha name specified in \code{\link{labs}}
is used for the title.}
By default (\code{\link{waiver}}), the name of the scale
object or tha name specified in \code{\link{labs}} is
used for the title.}

\item{title.position}{A character string indicating the
position of a title. One of "top" (default for a vertical
Expand Down
6 changes: 3 additions & 3 deletions man/guide_legend.Rd
Expand Up @@ -15,9 +15,9 @@
\arguments{
\item{title}{A character string or expression indicating
a title of guide. If \code{NULL}, the title is not shown.
By default (\code{\link{waiver()}}), the name of the
scale object or tha name specified in \code{\link{labs}}
is used for the title.}
By default (\code{\link{waiver}}), the name of the scale
object or tha name specified in \code{\link{labs}} is
used for the title.}

\item{title.position}{A character string indicating the
position of a title. One of "top" (default for a vertical
Expand Down
11 changes: 11 additions & 0 deletions man/layer.Rd
@@ -0,0 +1,11 @@
\name{layer}
\alias{layer}
\title{Create a new layer}
\usage{
layer(...)
}
\description{
Create a new layer
}
\keyword{internal}

13 changes: 7 additions & 6 deletions man/map_data.Rd
Expand Up @@ -5,15 +5,16 @@
map_data(map, region = ".", exact = FALSE, ...)
}
\arguments{
\item{map}{name of map provided by \code{\link{maps}}
package. These include \code{\link{county}},
\code{\link{france}}, \code{\link{italy}},
\code{\link{nz}}, \code{\link{state}}, \code{\link{usa}},
\code{\link{world}}, \code{\link{world2}}.}
\item{map}{name of map provided by the \pkg{maps}
package. These include \code{\link[maps]{county}},
\code{\link[maps]{france}}, \code{\link[maps]{italy}},
\code{\link[maps]{nz}}, \code{\link[maps]{state}},
\code{\link[maps]{usa}}, \code{\link[maps]{world}},
\code{\link[maps]{world2}}.}

\item{region}{name of subregions to include. Defaults to
\code{.} which includes all subregion. See documentation
for \code{\link{map}} for more details.}
for \code{\link[maps]{map}} for more details.}

\item{exact}{should the \code{region} be treated as a
regular expression (\code{FALSE}) or as a fixed string
Expand Down
3 changes: 1 addition & 2 deletions man/print.ggplot.Rd
Expand Up @@ -12,8 +12,7 @@

\item{vp}{viewport to draw plot in}

\item{...}{other arguments passed on to
\code{\link{ggplotGrob}}}
\item{...}{other arguments not used by this method}
}
\description{
Draw plot on current graphics device.
Expand Down
16 changes: 16 additions & 0 deletions man/waiver.Rd
@@ -0,0 +1,16 @@
\name{waiver}
\alias{waiver}
\title{A waiver object.}
\usage{
waiver()
}
\description{
A waiver is a "flag" object, similar to \code{NULL}, that
indicates the calling function should just use the
default value. It is used in certain functions to
distinguish between displaying nothing (\code{NULL}) and
displaying a default value calculated elsewhere
(\code{waiver()})
}
\keyword{internal}

0 comments on commit 08461b8

Please sign in to comment.