title: R How to estimate csv file size prior to writing it to disk
body: <p>Is there any way in R to estimate the file size of a csv file prior to actually writing it to disk via <code>write.csv</code> or <code>readr::write_csv</code>? I would like to implement a warning if the user accidentially tries to write huge files to disk in a function.</p>
  
  <p>There seems to be some relationship between memory footprint of a dataframe (<code>object.size</code>) and the size on disk, with the latter being considerably larger. However, the larger the object in memory, the smaller the difference. Also, there might be differences related to the structure of the dataframe.</p>
  
  <p>I do not want to force people to download large amounts of data, so please excuse the lack of an reproducible example.</p>