title: R: While loop input
body: <p>I am bit new to R and have a question about a program I am trying to write. I am hoping to take in files (as many as a user pleases) with a while loop (eventually using read.table on each) but it keeps breaking on me. 
  Here is what I have so far:</p>
  
  <pre><code>cat("Please enter the full path for your files, if you have no more files to add enter 'X': ")
  fil&lt;-readLines(con="stdin", 1)
  cat(fil, "\n")
  while (!input=='X' | !input=='x'){
  inputfile=input
  input&lt;- readline("Please enter the full path for your files, if you have no more files to add enter 'X': ")
  }
  if(input=='X' | input=='x'){
  exit -1
  }
  </code></pre>
  
  <p>When I run it (from the commandline (UNIX)) I get these results:</p>
  
  <pre><code>&gt; library("lattice")
  &gt; 
  &gt; cat("Please enter the full path for your files, if you have no more files to add enter 'X': ")
  Please enter the full path for your files, if you have no more files to add enter 'X': &gt; fil&lt;-readLines(con="stdin", 1)
  x
  &gt; cat(fil, "\n")
  x 
  &gt; while (!input=='X' | !input=='x'){ 
  + inputfile=input
  + input&lt;- readline("Please enter the full path for your files, if you have no more files to add enter 'X': ")
  + }
  Error: object 'input' not found
  Execution halted
  </code></pre>
  
  <p>I am not quite sure how to fix the problem, but I am pretty sure that it is probably a simple problem.
  Any suggestions?
  Thanks!</p>