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,

  1. the input field (if solution involves gui) must automatically focus ,
  2. 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

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -