Read and Write Data in R 

Learn how to read a data file as a data frame and write out a data frame to a file.

This tutorial will teach you the basics of R. It is not necessary to have any prior programming experience.

It goes without saying that in data science you will often be reading in and writing out data in R. R has several built-in interfaces for text data reading, writing, and understanding how to utilize these will add valuable tools to your R toolset.

Data is often stored in comma-separated file format, so we’ll learn how to read and write data in this format but the functions and syntax for reading data in other formats are very similar.

In this video we will work on the income data set which is a comma-separated file. What we want to do is read this data in a simple single command line. You can find it on the learning portal. So, we’ll:


  • give our data set a variable name and we’ll simply call it 'income'.

  • then, we’ll use the read CSV function, and we give this function the path or the folder directory of where our data sits. So, in my case, it’s within 'users'

  • after the forward-slash, I can simply tab and navigate my way there. Otherwise, you’re welcome to type this out by hand


Check out how our Data Science Bootcamp can help you reinforce this skill

To get started watch the video


In the next video, we will study Data Frames.