Chapter 2 Loading the Data

In this section, we will talk about loading csv files into R.

2.1 Folks using RStudio on their computers

  • Step 1:
    • Look at the upper right hand panel of your screen.
  • Step 2:
    • Find “Import Dataset” and click on it.
  • Step 3:
    • Choose “Text (base)” or “From CSV” (it will depend on your computer)
  • Step 4:
    • Find your data (for example : Titanic.csv) in the list that comes up. Choose it!
  • Step 5:
    • Now, look the bottom right hand panel of your screen. You should see a line of code with something like Titanic <- read.csv(“Titanic.csv”) or Titanic <- read_csv(“Titanic.csv”)
  • Step 6:
    • Copy that ENTIRE line of code.
  • Step 7:
    • Go to your Markdown file.
    • Look to the upper right corner of the file and find Insert Click it and then find “R” on the drop down menu, and click it!
    • You will notice a gray box appears on your Markdown file. This is called a chunk, and is basically a spot where we can type code.
  • Step 8:
    • Paste the line from Step 6 into this gray code chunk, and press the green arrow (the play button).
    • You are ready to go!! You now have the data loaded and you can work with it!

2.2 Folks using RStudio online

  • Step 1:
    • Look at the lower right hand quadrant of your RStudio screen.
  • Step 2:
    • At the top of that square, look for “Upload”.
  • Step 3:
    • Click Upload, and then browse for where you have stored the Titanic.csv data on your computer.
  • Step 4:
    • Once you have found the file, hit “Import”.
  • Step 5:
    • Now, look at the upper right hand panel of your screen.
  • Step 6:
    • Find “Import Dataset” and click on it.
  • Step 7:
    • Choose “Text (base)” or “From CSV” (it will depend on your computer)
  • Step 8:
    • Find the data you want (example: Titanic.csv) in the list that comes up. Choose it!
  • Step 9:
    • Now, look the bottom right hand panel of your screen. You should see a line of code with something like Titanic <- read.csv(“Titanic.csv”) or Titanic <- read_csv(“Titanic.csv”)
  • Step 10:
    • Copy that ENTIRE line of code.
  • Step 11:
    • Go to your Markdown file.
    • Look to the upper right corner of the file and find Insert Click it and then find “R” on the drop down menu, and click it!
    • You will notice a gray box appears on your Markdown file. This is called a chunk, and is basically a spot where we can type code.
  • Step 12:
    • Paste the line from Step 10 into this gray code chunk, and press the green arrow (the play button).
    • You are ready to go!! You now have the data loaded and you can work with it!