I would like to have a condition in my code that allows me to distinguish whether the code works in batch or interactive mode (via the console). It will be something like this:
if (interactive mode) {do this} else if (Batch mode) {do that}
Is there any way to achieve this? Thank you for your help.
You can use the function interactive. For example, doing this from a terminal
interactive
Rscript -e 'cat(interactive())'
returns FALSEfor me, and when executed interactive()from my session, RStudio returns TRUE.
FALSE
interactive()
TRUE
Source: https://habr.com/ru/post/1668738/More articles:Make sure date range touches time range - javaАлгоритм окклюзии углов - performancewhy the cable does not print when used in a function in rmarkdown - rApply shorthand for each seq element - clojureMerge two segments on the same circle if they intersect or intersect - language-agnosticCalculation of the intersection between two angular intervals - c ++How to build a grid of images in a strain map? - deep-learningThe best way to execute a python script in a given conda environment - pythonHow to get application style from an element, excluding default user agent styles - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1668743/does-strict-aliasing-apply-when-using-pointers-to-struct-members&usg=ALkJrhgqNd5v10sTstgylzWfMGlQ3AMApwAll Articles