title: Automatically write readRDS() statements from saveRDS() statements
body: <p>I often write <code>saveRDS()</code> statements after a good deal of data munging and this prompts me to immediately write <code>readRDS()</code> for future, reproducible coding accessing the .RDS files for faster loading into <code>R</code>.  My manual process for generating <code>readRDS()</code> statements from the typed <code>saveRDS()</code> statements is outlined below.  How can it be improved?  How can I write a macro/function to do this for me, in <code>EMACS</code> and/or <code>R</code>?</p>
  
  <pre><code>## I type these out:
  saveRDS(dems,"./_00_data_original/dems.RDS")
  saveRDS(meds,"./_00_data_original/meds.RDS")
  saveRDS(anti,"./_00_data_original/anti.RDS")
  
  ## Then I rectangle kill (C-x-r-k) the file names and commas
  ## and rectangle yank (C-x-r-y) them on the left hand side
  ## note:  depends on filenames being equal lengths
  dems,saveRDS("./_00_data_original/dems.RDS")
  meds,saveRDS("./_00_data_original/meds.RDS")
  anti,saveRDS("./_00_data_original/anti.RDS")
  
  ## then I Esc-Shift-5 to query replace ",saveRDS" with " &lt;- readRDS"
  dems &lt;- readRDS("./_00_data_original/dems.RDS")
  meds &lt;- readRDS("./_00_data_original/meds.RDS")
  anti &lt;- readRDS("./_00_data_original/anti.RDS")
  </code></pre>