title: Process substitution
body: <p>I've given a look around about what puzzles me and I only found this:
  <a href="https://stackoverflow.com/questions/4274171/do-some-programs-not-accept-process-substitution-for-input-files">Do some programs not accept process substitution for input files?</a></p>
  
  <p>which is partially helping, but I really would like to understand the full story. 
  I noticed that some of my R scripts give different (ie. wrong) results when I use process substitution.</p>
  
  <p>I tried to pinpoint the problem with a test case:</p>
  
  <p>This script:</p>
  
  <pre><code>#!/usr/bin/Rscript
  
  args  &lt;- commandArgs(TRUE)
  file  &lt;-args[1]
  cat(file)
  cat("\n")
  data &lt;- read.table(file, header=F)
  cat(mean(data$V1))
  cat("\n")
  </code></pre>
  
  <p>with an input file generated in this way:</p>
  
  <pre><code>$ for i in `seq 1 10`; do echo $i &gt;&gt; p; done
  $ for i in `seq 1 500`; do cat p &gt;&gt; test; done
  </code></pre>
  
  <p>leads me to this:</p>
  
  <pre><code>$ ./mean.R test
  test
  5.5
  
  $ ./mean.R &lt;(cat test)
  /dev/fd/63
  5.501476
  </code></pre>
  
  <p>Further tests reveal that some lines are lost...but I would like to understand why. Does read.table (scan gives the same results) uses seek?</p>
  
  <p>Ps.
  with a smaller test file (100) an error is reported:</p>
  
  <pre><code>$./mean.R &lt;(cat test3)
  /dev/fd/63
  Error in read.table(file, header = F) : no lines available in input
  Execution halted
  </code></pre>
  
  <p>Add #1: with a modified script that uses scan the results are the same.</p>