Skip to content

Commit dcbc99f

Browse files
committed
Export build function
1 parent 80e4803 commit dcbc99f

4 files changed

Lines changed: 13 additions & 40 deletions

File tree

NAMESPACE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Generated by roxygen2 (4.0.1): do not edit by hand
22

33
export(gg2list)
4+
export(ggplot_build2)
45
export(layer2traces)
56
export(now)
67
export(paramORdefault)

R/build_function.R

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
#' ggplot build function with enhanced return
2-
#'
3-
#' This function builds on top of ggplot2::ggplot_build by
4-
#' Hadley Wickham <h.wickham@@gmail.com> and Winston Chang <winston@@stdout.org>
5-
#' (http://ggplot2.org, https://github.com/hadley/ggplot2).
6-
#'
7-
#' @param plot ggplot2 plot
8-
#' @return List with (data, panel, plot, prestats.data) where prestats.data
9-
#' is the data as it is prior to calculate_stats() call
10-
#' @keywords internal
11-
make_ggplot_build2 <- function(plot) {
1+
make_ggplot_build2 <- local({
122
# Get body of the original function, in list form
133
ggplot_build2 <- ggplot2::ggplot_build
144
g_b <- as.list(body(ggplot_build2))
@@ -27,17 +17,19 @@ make_ggplot_build2 <- function(plot) {
2717

2818
# Assign the modified body back into the function
2919
body(ggplot_build2) <- as.call(g_b2)
30-
ggplot_build2(plot)
31-
}
20+
ggplot_build2
21+
})
3222

33-
#' wrapper for build function
23+
#' ggplot build function with enhanced return
3424
#'
35-
#' It would be inefficient to perform each step found in make_ggplot_build2()
36-
#' every time we want to make use of its output.
25+
#' This function builds on top of ggplot2::ggplot_build by
26+
#' Hadley Wickham <h.wickham@@gmail.com> and Winston Chang <winston@@stdout.org>
27+
#' (http://ggplot2.org, https://github.com/hadley/ggplot2).
3728
#'
3829
#' @param plot ggplot2 plot
3930
#' @return List with (data, panel, plot, prestats.data) where prestats.data
4031
#' is the data as it is prior to calculate_stats() call
32+
#' @export
4133
#' @keywords internal
4234
ggplot_build2 <- function(plot) {
4335
make_ggplot_build2(plot)

man/ggplot_build2.Rd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
% Generated by roxygen2 (4.0.1): do not edit by hand
22
\name{ggplot_build2}
33
\alias{ggplot_build2}
4-
\title{wrapper for build function}
4+
\title{ggplot build function with enhanced return}
55
\usage{
66
ggplot_build2(plot)
77
}
@@ -13,8 +13,9 @@ List with (data, panel, plot, prestats.data) where prestats.data
1313
is the data as it is prior to calculate_stats() call
1414
}
1515
\description{
16-
It would be inefficient to perform each step found in make_ggplot_build2()
17-
every time we want to make use of its output.
16+
This function builds on top of ggplot2::ggplot_build by
17+
Hadley Wickham <h.wickham@gmail.com> and Winston Chang <winston@stdout.org>
18+
(http://ggplot2.org, https://github.com/hadley/ggplot2).
1819
}
1920
\keyword{internal}
2021

man/make_ggplot_build2.Rd

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)