title: R Programming - Error in sys.call(sys.parent()) : node stack overflow
body: <pre><code>pollutantmean &lt;- function(directory, pollutant, id = 1:332) {
    for(i in id) {
  
      filenames &lt;- list.files(path = directory, pattern = ".csv", full.names = TRUE);
  
      pollutant_data &lt;- NULL;
  
      for (f in filenames){
        fdata &lt;- read.csv(f, header=TRUE);
        pollutant_data &lt;- c(pollutant_data,fdata$pollutant);
      }
  
      poll_mean &lt;- mean(pollutant_data, na.rm=TRUE);
  
      return(poll_mean);
    }
  
  
  }
  
  source("pollutantmean.R");
  </code></pre>
  
  <p>When I ran the code shown above, I got the following error message .... 
  Error in sys.call(sys.parent()) : node stack overflow
  Error during wrapup: node stack overflow</p>
  
  <p>Why am I seeing this error and how do I avoid it?
  Thank You! </p>