Export Data from R (csv , txt and other formats) | R Tutorial 1.6 | MarinStatsLectures

Export data out of R and save in various formats such as csv, tab-delimited, space-delimited. For more Statistics and R Programming Tutorials: https://goo.gl/4vDQzT Dataset and R Script: https://goo.gl/tJj5XG

How to export data out of R and save in various formats such as csv, tab-delimited, space-delimited.

▶︎ In this R programming tutorial, you will learn to use “write.table”, “write.csv”, “write.csv2”, “write.command” and “write.delim” to export data out of R.

▶︎ In this tutorial, you will learn to use “sep” argument to specify the file format or separator for the values, “row.names” argument to include or exclude the row names.

You can access and download the dataset and R script here:

◼︎ Topics in the video:

0:00:34 Introducing the ‘write. table’ command for exporting data out of R.

0:00:39 How to access the help menu for a command in R

0:00:53 How to use the ‘write.table’ command in R Software

0:01:08 How to use “sep” argument to specify the file format or separator for the values in R

0:01:50 How to include or exclude the row names while exporting data out of R Programming software using ‘row.names’ argument

0:02:21 How to save file exported from R to a folder other than the current working directory:

0:03:01 How to use the “write.csv” command to export data from R (this will not require using “sep” argument as it is implied in the write.csv that we would like this to be saved as a comma separated value file)

0:03:22 a quick overview of “write.csv2” command that is used in Western Europe and would use a comma for a decimal point and a semicolon for a separator rather than a comma

0:03:33 How to use write.command in for saving in other file formats for example a tab delimited text file

This video is a tutorial for programming in R Statistical Software for beginners, using RStudio.

♠︎♣︎♥︎♦︎To learn more:

Subscribe: https://goo.gl/4vDQzT
website: http://statslectures.com
Instagram: https://goo.gl/fdPiDn

Our Team:
Content Creator: Mike Marin (B.Sc., MSc.) Senior Instructor at UBC.
Producer: Ladan Hamadani (B.Sc., BA., MPH)

These #RTutorial are created by #marinstatslectures to support the statistics course (#SPPH400) at The University of British Columbia(UBC) although we make all videos available to the public for free.


Bromoteknada says:


Versatile says:

Awesome!!! I love the way you teach.

Mita Tran says:

I have .txt file, I dont know how to export file .bed or .bedGraph? Could you nice help me how to do? Thank you very much!

Umar Alhaji Abubakar says:

Great. This is so self explanatory and help-full. Thanks

Priscila Borges says:

You are a hero of science, my friend.

Deepan Dharmaraj says:

Hi Mike your tutorials are absolutely fantastic and very easy to follow superb work please keep posting tutorials on R! Thank you so much for producing excellent R video tutorials!

Chris Brook says:

how do you set the name of the file as data from a variable e.g. creating the file in a for loop (so it wouldn’t be overwritten when the next file is created)

thanks in advance 🙂

David Hunt says:

I recommend this series as THE go-to intro reference for undergrads learning R. I still use it as a reference myself sometimes. Keep up the good work!

Jenova fmv says:

thx. It really helps me a lot.

sangeetha b says:

Thanks a lot for the series…

Naomi Satam says:

Donald Trump is -25.5 lol

flamboyant person says:

Great to see you back. Could you please make videos on advance machine learning in R? Thank you.

mark says:

Great video – thank you.
For me – the write.table command is returning errors – can anyone help please?

write.table(datatoexport, file=”ExportedLundDataExample.csv”, sep=”,”)
Error in file(file, ifelse(append, “a”, “w”)) :
cannot open the connection
In addition: Warning message:
In file(file, ifelse(append, “a”, “w”)) :
cannot open file ‘ExportedLundDataExample.csv’: Permission denied

Charles Henderson says:

Excellent, “to the point” presentation! Thanks!

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!