title: Auto-generate code in R to create data frame
body: <p>Is there a way in R to take a dataframe and auto-generate lines of code that would, if run, create that same dataframe from scratch?</p>
  
  <p>So if my starting point is a dataframe df:</p>
  
  <pre><code>field_1   field_2 
  ————————————————-
  1         A
  2         B
  3         C
  </code></pre>
  
  <p>I’d like some way to generate code automatically to recreate the data, eg:</p>
  
  <pre><code>df &lt;- data.frame(field_1 = c(1, 2, 3), field_2 = c(“A”, “B”, “C”))
  </code></pre>
  
  <p>In my case these dataframes would always be small - max about 50 rows and 3-4 columns.</p>
  
  <p>Thank you.</p>