1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
\name{bolus.ggplot}
\alias{bolus.ggplot}
\alias{bolus}
\alias{bolus.proto}
\alias{digest.ggplot}
\alias{digest.proto}
\title{Create a bolus object}
\author{Hadley Wickham <h.wickham@gmail.com>}
\description{
A bolus is a list suitable for digesting.
}
\usage{bolus.ggplot(x, ...)}
\arguments{
\item{x}{}
\item{...}{}
}
\details{Most ggplot objects have components that should be hashed when creating
a digest (especially since most ggplot objects are proto objects and
are also self-documenting). The bolus methods ensure that only appropriate
components are digested.}
\examples{hash_tests <- list(
list(
ggplot() + scale_x_continuous() + scale_y_continuous(),
ggplot() + scale_y_continuous() + scale_x_continuous()
),
list(
qplot(mpg, wt, data=mtcars, na.rm = FALSE),
ggplot(mtcars, aes(y=wt, x=mpg)) + geom_point()
),
list(
qplot(mpg, wt, data=mtcars, xlab = "blah"),
qplot(mpg, wt, data=mtcars) + xlab("blah")
)
)
lapply(hash_tests, function(equal) {
hashes <- lapply(equal, digest.ggplot)
if (length(unique(hashes)) != 1) {
lapply(equal, function(x) print(str(bolus(x))))
stop("Above plots not equal")
}
})}
\keyword{internal}
|