% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils_progressively.R
\name{progressively}
\alias{progressively}
\title{Progressively}
\usage{
progressively(f, p = NULL)
}
\arguments{
\item{f}{a function to add progressor functionality to.}

\item{p}{a function such as one created by \code{progressr::progressor()} - also accepts purrr-style lambda functions.}
}
\value{
a function that does the same as \code{f} but it calls \code{p()} after iteration.
}
\description{
This function helps add progress-reporting to any function - given function \code{f()} and progressor \code{p()},
it will return a new function that calls \code{f()} and then (on exiting) will call \code{p()} after every iteration.
This is inspired by purrr's \code{safely}, \code{quietly}, and \code{possibly} function decorators.
}
\examples{
\dontshow{.for_cran()}
\donttest{
try({ # prevents cran errors

urls <- rep("https://github.com/nflverse/nflverse-data/releases/download/test/combines.csv",3)

lapply(urls, progressively(read.csv, ~cli::cli_progress_step('Loading...')))

read_rosters <- function(urls){
  p <- progressr::progressor(along = urls)
  lapply(urls, progressively(read.csv, p))
}

progressr::with_progress(read_rosters())

})
}

}
\seealso{
\url{https://nflreadr.nflverse.com/articles/exporting_nflreadr.html} for vignette on exporting nflreadr in packages
}
