File: handler_rstudio.Rd

package info (click to toggle)
r-cran-progressr 0.15.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,132 kB
  • sloc: sh: 13; makefile: 7
file content (57 lines) | stat: -rw-r--r-- 1,746 bytes parent folder | download | duplicates (2)
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
48
49
50
51
52
53
54
55
56
57
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/handler_rstudio.R
\name{handler_rstudio}
\alias{handler_rstudio}
\title{Progression Handler: Progress Reported in the RStudio Console}
\usage{
handler_rstudio(
  intrusiveness = getOption("progressr.intrusiveness.gui", 1),
  target = "gui",
  title = function() format(Sys.time(), "Console \%X"),
  ...
)
}
\arguments{
\item{intrusiveness}{(numeric) A non-negative scalar on how intrusive
(disruptive) the reporter to the user.}

\item{target}{(character vector) Specifies where progression updates are
rendered.}

\item{title}{(character or a function) The "name" of the progressor, which
is displayed in front of the progress bar.  If a function, then the name
is created dynamically by calling the function when the progressor is
created.}

\item{\ldots}{Additional arguments passed to \code{\link[=make_progression_handler]{make_progression_handler()}}.}
}
\description{
Progression Handler: Progress Reported in the RStudio Console
}
\section{Requirements}{

This progression handler works only in the RStudio Console.
}

\section{Use this progression handler by default}{

To use this handler by default whenever using the RStudio Console, add
the following to your \file{~/.Rprofile} startup file:

\if{html}{\out{<div class="sourceCode r">}}\preformatted{if (requireNamespace("progressr", quietly = TRUE)) \{
  if (Sys.getenv("RSTUDIO") == "1" && !nzchar(Sys.getenv("RSTUDIO_TERM"))) \{
    options(progressr.handlers = progressr::handler_rstudio)
  \}
\}
}\if{html}{\out{</div>}}
}

\examples{
if (requireNamespace("rstudioapi", quietly = TRUE) && rstudioapi::isAvailable()) {

  handlers("rstudio")
  with_progress({ y <- slow_sum(1:10) })
  print(y)
  
}
}