Skip to content

Commit

Permalink
Don't export Progress RC class.
Browse files Browse the repository at this point in the history
Closes #535
  • Loading branch information
hadley committed Aug 27, 2014
1 parent 3769ef5 commit b431d30
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 37 deletions.
3 changes: 1 addition & 2 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ S3method(update,tbl_sql)
export("%.%")
export("%>%")
export(.datatable.aware)
export(Progress)
export(anti_join)
export(arrange)
export(as.tbl)
Expand Down Expand Up @@ -378,6 +377,7 @@ export(ntile)
export(order_by)
export(partial_eval)
export(percent_rank)
export(progress_estimated)
export(query)
export(rbind_all)
export(rbind_list)
Expand Down Expand Up @@ -438,7 +438,6 @@ export(ungroup)
export(union)
export(with_order)
exportClasses(MonetDBQuery)
exportClasses(Progress)
exportClasses(Query)
import(assertthat)
importFrom(Rcpp,Rcpp.plugin.maker)
Expand Down
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# dplyr 0.2.0.99

* The `Progress` refclass is no longer exported to avoid conflicts with shiny.
Instead use `progress_estimated()` (#535).

* `arrange()` and `group_by()` correctly work together (#491).

* Call substitution stopped too early when a sub expression contained a `$` (#502).
Expand Down
25 changes: 15 additions & 10 deletions R/progress.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,39 @@
#' This reference class represents a text progress bar displayed estimated
#' time remaining. When finished, it displays the total duration.
#'
#' Progress bar will wait until at least \code{min_time} seconds have
#' elapsed before displaying any results.
#'
#' @param n Total number of
#' @param min_time Progress bar will wait until at least \code{min_time}
#' seconds have elapsed before displaying any results.
#' @return A ref class with methods \code{tick()}, \code{show()},
#' \code{pause()}, and \code{stop()}.
#' @keywords internal
#' @export Progress
#' @exportClass Progress
#' @export
#' @examples
#' p <- Progress(3)
#' p <- progress_estimated(3)
#' p$tick()
#' p$tick()
#' p$tick()
#'
#' p <- Progress(3)
#' p <- progress_estimated(3)
#' for (i in 1:3) p$pause(0.1)$tick()$show()
#'
#' p <- Progress(3)
#' p <- progress_estimated(3)
#' p$tick()$show()$
#' pause(1)$stop()
#'
#' # If min_time is set, progress bar not shown until that many
#' # seconds have elapsed
#' p <- Progress(3, min_time = 3)
#' p <- progress_estimated(3, min_time = 3)
#' for (i in 1:3) p$pause(0.1)$tick()$show()
#'
#' \dontrun{
#' p <- Progress(10, min_time = 3)
#' p <- progress_estimated(10, min_time = 3)
#' for (i in 1:10) p$pause(0.5)$tick()$show()
#' }
progress_estimated <- function(n, min_time = 0) {
Progress(n, min_time = min_time)
}

Progress <- setRefClass("Progress",
fields = list(
n = "numeric",
Expand Down
42 changes: 20 additions & 22 deletions man/Progress-class.Rd → man/progress_estimated.Rd
Original file line number Diff line number Diff line change
@@ -1,46 +1,44 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
\docType{class}
\name{Progress-class}
\alias{Progress}
\alias{Progress-class}
\name{progress_estimated}
\alias{progress_estimated}
\title{Progress bar with estimated time.}
\usage{
progress_estimated(n, min_time = 0)
}
\arguments{
\item{n}{Total number of}

\item{min_time}{Progress bar will wait until at least \code{min_time}
seconds have elapsed before displaying any results.}
}
\value{
A ref class with methods \code{tick()}, \code{show()},
\code{pause()}, and \code{stop()}.
}
\description{
This reference class represents a text progress bar displayed estimated
time remaining. When finished, it displays the total duration.
}
\details{
Progress bar will wait until at least \code{min_time} seconds have
elapsed before displaying any results.
}
\section{Methods}{

\describe{
\item{\code{begin()}}{Initialise timer. Call this before beginning timing.}

\item{\code{pause(x)}}{Sleep for x seconds. Useful for testing.}

\item{\code{tick()}}{Process one element}
}}
\examples{
p <- Progress(3)
p <- progress_estimated(3)
p$tick()
p$tick()
p$tick()

p <- Progress(3)
p <- progress_estimated(3)
for (i in 1:3) p$pause(0.1)$tick()$show()

p <- Progress(3)
p <- progress_estimated(3)
p$tick()$show()$
pause(1)$stop()

# If min_time is set, progress bar not shown until that many
# seconds have elapsed
p <- Progress(3, min_time = 3)
p <- progress_estimated(3, min_time = 3)
for (i in 1:3) p$pause(0.1)$tick()$show()

\dontrun{
p <- Progress(10, min_time = 3)
p <- progress_estimated(10, min_time = 3)
for (i in 1:10) p$pause(0.5)$tick()$show()
}
}
Expand Down
6 changes: 3 additions & 3 deletions man/rbind.Rd
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
% Generated by roxygen2 (4.0.1): do not edit by hand
\name{rbind_all}
\name{rbind_list}
\alias{rbind_all}
\alias{rbind_list}
\title{Efficiently rbind multiple data frames.}
\usage{
rbind_all(dots)

rbind_list(...)

rbind_all(dots)
}
\arguments{
\item{dots,...}{list of data frames to combine. With \code{rbind_all},
Expand Down

0 comments on commit b431d30

Please sign in to comment.