User input when executing R code in batch mode -
i searching way user input inside loop while executing in batch mode.
readlines()
, scan()
work me in interactive mode only, in batch mode start read in lines of code user input, unless code surrounded {}
, inconvenient. need simple solution 1 integer value in way can type in value , press enter,
- the input field (if solution involves gui) must automatically focus ,
- enter must trigger end of input/submission.
i can't find way satisfy both conditions, e.g. ginput()
gwidgets activates input field, enter doesn't trigger form submission.
update:
i can't test right now, take @ ?menu
, have pop gui window.
i'm not if work, different in takes mouse-click response.
original answer:
as per documentation ?readline
:
this can used in interactive session.
..
in non-interactive use result if response return , value "".
if waiting 1 piece of information, , not know piece of information before beginning execution of script (presumably, there decision made dependent on results earlier in script), 1 alternative break script 3 parts:
- everything before decision point.
- an interactive script prompts input
- everything after decision point.
and chain 3 having first end calling second in interactive session. have second end calling third.
Comments
Post a Comment