Detect whether a stream supports
\\r (Carriage return)
In a terminal,
\\r moves the cursor to the first position of the
same line. It is also supported by most R IDEs.
\\r is typically
used to achieve a more dynamic, less cluttered user interface, e.g.
to create progress bars.
If the output is directed to a file, then
\\r characters are typically
unwanted. This function detects if
\\r can be used for the given
stream or not.
The detection mechanism is as follows:
cli.dynamicoption is set to
cli.dynamicoption is set to anything else,
R_CLI_DYNAMICenvironment variable is not empty and set to the string
R_CLI_DYNAMICis not empty and set to anything else,
If the stream is a terminal, then
If the stream is the standard output or error within RStudio, the macOS R app, or RKWard IDE,
is_dynamic_tty() #>  FALSE is_dynamic_tty(stdout()) #>  FALSE