title: If my function doesn't work on every object, how do I skip those objects?
body: <p>I am trying to write a function and apply it to a list. Inside my function is a function written by some one else. If I make my list very easy, everything will work fine. But if I use all the real data I have, there are some bad objects and the outside function doesn't work and my whole function won't go through.</p>
  
  <p><strong>What do I type to say "If the outside function doesn't work, skip that object and move to the next one in the list."?</strong>  With or without NA, doesn't matter.</p>
  
  <p>I cannot figure out how to write a reproducible example that would result in a list of dataframes, which is what happens inside this function. I'm willing to take any help to improve this question. </p>
  
  <p>My function is something like this:</p>
  
  <pre><code>do_this&lt;- function(x){
    outside_function(x))%&gt;%  #this returns a dataframe for each object
    filter()%&gt;%
    select()%&gt;%
    summarise_each(funs(mean(., na.rm = TRUE))) #by the end the df is down to one row
  }
  </code></pre>
  
  <p>This is how I apply the function to the list to come up with my final dataframe.</p>
  
  <pre><code>df&lt;-bind_rows(lapply(my_list, do_this))
  </code></pre>