title: write.csv() within a user defined function : R
body: <p>I have created a function wherein I want to export the generated data frame result in a .csv file. But every time I run the function, the data should be stored in a separate file as specified by the user function. Eg:</p>
  
  <pre><code>write&lt;- function (a, b, y)  
  {
    x &lt;- a + b
    write.csv(x, file = paste0(",y,"), fileEncoding = "UTF-16LE")
  }
  </code></pre>
  
  <blockquote>
    <p>write(2, 3, "C:\Users\lol\Desktop\file1.csv")</p>
    
    <p>write(2, 4, "C:\Users\lol\Desktop\file2.csv")</p>
  </blockquote>
  
  <p>Is there any way by which this can be done?
  Thanks in advance</p>