title: quantile function through dfs of list
body: <p>I´ve got a zip (48GB) with 1800 .csv files and each file with 365 columns (days) and 22700 rows (observations). I need to calculate quantiles (5%, 50, and 95%) per each observations along a selected number of csv files.</p>
  <p>So far, this has been my strategy:</p>
  <p>First, I listed the selected .csv files as follow:</p>
  <pre><code># selected csv
  cas_list &lt;-pharma$CAS.Number
  cas_list &lt;- paste0(cas_list, &quot;_Ctot.csv&quot;)  #only 105 .csv files
  
  # identify zipped file
  zipped_file = &quot;ctot_minus_invalids.zip&quot;
  
  # list selected csv
  lst = vector(&quot;list&quot;, length(cas_list))
  
  for (i in seq_along(cas_list))
    lst[[i]] = read.csv(unz(zipped_file, cas_list[i]), stringsAsFactors = F, check.names=FALSE)
  </code></pre>
  <p>So far so good, I ended up with a large list (105 elements, 7GB) having following structure:</p>
  <pre><code>&gt; str(lst[1])
  List of 1
   $ :'data.frame':   22731 obs. of  368 variables:
    ..$                 : int [1:22731] 8000005 8115258 8115717 8000008 8102609 8103951 8000007 8000006 8205878 8205857 ...
    ..$ 2012/12/31_Cbulk: num [1:22731] 0.000000000000584 0.000000000008771 0.000000000006266 0.000000000000214 0.000000000004982 ...
    ..$ 2013/01/01_Cbulk: num [1:22731] 0.000000000000468 0.000000000007096 0.000000000005331 0.000000000000214 0.000000000004968 ...
    ..$ 2013/01/02_Cbulk: num [1:22731] 0.000000000000437 0.000000000005835 0.000000000005354 0.000000000000215 0.000000000004954 ...
  
  &gt; str(lst[2])
  List of 1
   $ :'data.frame':   22731 obs. of  368 variables:
    ..$                 : int [1:22731] 8000005 8115258 8115717 8000008 8102609 8103951 8000007 8000006 8205878 8205857 ...
    ..$ 2012/12/31_Cbulk: num [1:22731] 0.0000000000427 0.0000000006187 0.0000000004663 0.0000000000141 0.0000000003348 ...
    ..$ 2013/01/01_Cbulk: num [1:22731] 0.0000000000346 0.0000000005025 0.0000000004001 0.0000000000141 0.0000000003339 ...
    ..$ 2013/01/02_Cbulk: num [1:22731] 0.0000000000324 0.0000000004151 0.0000000004008 0.0000000000141 0.0000000003331 ...
  </code></pre>
  <p>Although this approach seems to be very memory intensive, it worked!.
  Now, my issue is about how to apply a quantile function through each observation per df in the whole list. In order to have per each df in the list something like:</p>
  <pre><code>                   5%         50%       95%
   8000005   -0.6125624  0.09364346 2.0342648
   8115258   -1.4404549 -0.40036638 1.3918166
   8115717   -1.5614326 -0.08835999 1.5153081
   .... so on
  </code></pre>
  <p>I have tried the following code:</p>
  <pre><code>result &lt;- lapply(lst, function(x) {
    
    t(lapply(lst[i], quantile, probs = c(0.05, 0.5, 0.95), na.rm=T))
    
  })
  
  df &lt;- data.frame(matrix(unlist(result), nrow=length(result), byrow=TRUE))
  </code></pre>
  <p>but I ended up with df that seems calculated quantiles per df only and it did not consider the observations :</p>
  <pre><code>                    X1               X2             X3
  1   0.00000000000031103 0.00000000007249 0.000000001456
  2   0.00000000000031103 0.00000000007249 0.000000001456
  3   0.00000000000031103 0.00000000007249 0.000000001456
  </code></pre>
  <p>Do you have any idea of what is wrong in my quantile code?
  Do you think in another more efficient way to do the same?
  I will appreciate your feedback.</p>