title: Compute minima across list elements with NA
body: <p>I got a klugey solution but feel silly writing so much code for what seems simple. This goes pretty fast with lists of a few dozen MB, so I don't need to improve efficiency. But I'd still like help.</p>
  <p>I have a large list (n elements, each one is a vector of length m). I need to get the m minimum values across all n elements (what I mean is obvious in code if this is confusing). There are NAs, in some cases with 0 complete cases and in most cases with &gt;=1 complete case. I wrote some code that works fine but it feels like there should be a much simpler way to get here. Can you streamline this code?</p>
  <p>Specifically, is there a way to avoid the conditional for the minimum function, and is there an apply-family function that would let me avoid the first <code>cbind</code>?</p>
  <pre><code># make data
  rawval&lt;-replicate(10, sample(c(1:10, NA), size = 10, replace =T)
       , simplify = F)
  
  # this seems clunky, does this function have a name?
  mymin&lt;-function(x)ifelse(all(is.na(x)), NA, min(x, na.rm =T))
  
  # I don't see why I should need two apply family functions here
  tomin&lt;-sapply(rawval, cbind) %&gt;%  apply(MARGIN = 1, FUN = mymin)
  </code></pre>
  <p>Apologies, I suspect this is a duplicate question :(</p>