From b431d3003ef05875b1cb566335cf4d08f8f8e9ec Mon Sep 17 00:00:00 2001 From: hadley Date: Wed, 27 Aug 2014 14:27:27 -0500 Subject: [PATCH] Don't export Progress RC class. Closes #535 --- NAMESPACE | 3 +- NEWS.md | 3 ++ R/progress.R | 25 ++++++----- ...rogress-class.Rd => progress_estimated.Rd} | 42 +++++++++---------- man/rbind.Rd | 6 +-- 5 files changed, 42 insertions(+), 37 deletions(-) rename man/{Progress-class.Rd => progress_estimated.Rd} (52%) diff --git a/NAMESPACE b/NAMESPACE index f75a3b5238..c8f5013df5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -292,7 +292,6 @@ S3method(update,tbl_sql) export("%.%") export("%>%") export(.datatable.aware) -export(Progress) export(anti_join) export(arrange) export(as.tbl) @@ -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) @@ -438,7 +438,6 @@ export(ungroup) export(union) export(with_order) exportClasses(MonetDBQuery) -exportClasses(Progress) exportClasses(Query) import(assertthat) importFrom(Rcpp,Rcpp.plugin.maker) diff --git a/NEWS.md b/NEWS.md index b46ba2d1c3..9ea3999568 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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). diff --git a/R/progress.R b/R/progress.R index c7ce23ca5f..e8535135eb 100644 --- a/R/progress.R +++ b/R/progress.R @@ -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", diff --git a/man/Progress-class.Rd b/man/progress_estimated.Rd similarity index 52% rename from man/Progress-class.Rd rename to man/progress_estimated.Rd index a5aa8fb25e..b68c1d52d1 100644 --- a/man/Progress-class.Rd +++ b/man/progress_estimated.Rd @@ -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() } } diff --git a/man/rbind.Rd b/man/rbind.Rd index 6fef780538..b9329d5979 100644 --- a/man/rbind.Rd +++ b/man/rbind.Rd @@ -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},