You can export a data frame as a csv file in R using the write.csv()
function. Here is an example:
Assuming you have a data.frame called my_data
that you want to export to CSV:
main.r61 chars2 lines
This will write my_data
to a CSV file located at "path/to/my_data.csv". The row.names = FALSE
argument ensures that row numbers are not included in the exported file.
If you want to export a data frame as a TSV (tab-separated values) instead of a CSV, then you can use the write.table()
function with the sep = "\t"
argument:
main.r75 chars2 lines
Note that you should replace "path/to/my_data.csv" or "path/to/my_data.tsv" with the actual file path where you want to save the exported file.
gistlibby LogSnag