0

I want to write a small tool also for the use of collegues, who do not necessarily have expertise with programming. Therefore, I wanted to implement the possibility to simply run the script from a file, which is supposed to ask for two sequences:

exon1 <- readline(prompt = "Enter the first Exon: \n")
exon2 <- readline(prompt = "Enter the second Exon: \n")

Input e.g.:

ATGTTCC CGAGGAGAGCCACGCCAAGCCGCCGCTGGCGGGGCGTTGGCTGC TGTCCTGGCAATCGTGGTACGGACCGCGGCGAAGTTTGCGCCTGCGGAC GCTTTGCCGGCTGCAGGCCGCCCGGCCTGTGTTCAGATGGCGGCCCGCTCT CCGGGTCGTATGGAGGAGCAATACCGAGAGTAGAG

This results in 2 problems:

  1. Executing the script using >Rscript PATH_TO\file.R from the windows command prompt results in the script running, but not stopping for user input
  2. When running the script from RStudio or an R-console in general, it results in an error, as R interpretes only the first line of the sequence as the input, every other line as a variable, which of course does not exists.

So, how do I execute an .R file in the simplest way that stops for user input before continuing with the rest of the code? And how can I alter the readline() function, so that an input simply copied from a database and thus including line breaks is interpreted as a single input?

the_ermine
  • 37
  • 6
  • 1
    I have answered a related question [here](https://stackoverflow.com/questions/70521543/how-to-get-a-user-input-in-command-prompt-and-pass-it-to-r/70521943#70521943). I think you will find the answer to both your questions there. – jpiversen Feb 19 '22 at 15:37

0 Answers0