title: apply function to every element in data.frame and return data.frame
body: <p>UPDATE: before, I used the <code>paste</code> function as an example instead of an arbitrary <code>myFun</code> function. That problem was slightly easier, because <code>paste</code> can actually operate on vectors, while <code>myFun</code> can not.</p>
  
  <p>I would like to apply my own function element-wise to every element in a data.frame, and get the modified data.frame as a return value.</p>
  
  <p>Example:</p>
  
  <pre><code>&gt; df &lt;- data.frame(c(1,2,3), c(2,3,4))
  &gt; df
    c.1..2..3. c.2..3..4.
  1          1          2
  2          2          3
  3          3          4
  &gt; df_x &lt;- magical_apply_function(df, function(x) myFun
  &gt; df_x
    c.1..2..3. c.2..3..4.
  1         myFun(1)         myFun(2)
  2         myFun(2)         myFun(3)
  3         myFun(3)         myFun(4)
  </code></pre>
  
  <p>I'm completely baffled to not be able to find the answer to this problem anywhere on the internet. Most resources talk about <code>apply</code>, <code>lapply</code>, and <code>sapply</code> but those only work on vectors/lists and they only return lists.</p>
  
  <p>Are for loops really the only way to go here?</p>