title: R studio Error in `$<-.data.frame`(`*tmp*`) : replacement has 1 row, data has 0
body: <p>I am subsetting a set of data frames, each data frame will be subsetted into several smaller data frames. Some will produce empty data frames and give an error as in title. </p>
  
  <p>My question: if I ran the script in R console, the script will be executed and new data frames will be generated even with the error messages. but if I use "source" in R studio or try to put the scripts in a function or use a for loop, the scripts will stop running and just display the error message.</p>
  
  <p>Is there a solution? thank you!</p>