VOOZH about

URL: https://www.geeksforgeeks.org/r-language/writing-to-csv-files-in-r/

⇱ Writing to CSV files in R - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Writing to CSV files in R

Last Updated : 26 Mar, 2021

For Data Analysis sometimes creating CSV data file is required and do some operations on it as per our requirement. So, In this article we are going to learn that how to write data to CSV File using R Programming Language.

To write to csv file write.csv() function is used.

Syntax: write.csv(data, path)

Parameter:

  • data: data to be added to csv
  • path: pathname of the file

Approach:

  • Create a DataFrame
  • Pass required values to the function
  • Write to file

Let us first create a data frame.

Example:

Output:

👁 data in console
Our Data in console

Now let us write this data to a csv file and save it to a required location.

Example:

Output:

👁 CSV file with data
CSV File with data
Comment
Article Tags:
Article Tags:

Explore