Key Concepts

Important R Functions

  • read.csv()
  • here()
  • mean()
  • head()
  • dim()

Readings

These questions cover the material in:

Data

You need to download the file week_03_pre_class_2021.csv from the course GitHub site.

Here Package

You’ll need to install the here package to complete this assignment.

Hint: remember the install.packages() function?

Reading a CSV File

You’ll be using the following two functions to read data into R:

I’ve created an updated video tutorial, you can find it here.

There’s also a text walkthrough here. and the original video tutorial is here.

Questions

Question 1

Make sure you have downloaded the data file week_03_practice_data.csv and saved it to the data subdirectory of your main course RProject directory.

  1. Read the data file into a data.frame called my_data in R.

NOTE: To receive credit for you answer you must:

  • Use the here() function to tell R where to find your data file.
  • the data file must be in the data subdirectory.
  • The object my_data must be a data.frame object. You will not receive credit if my_data is a tibble, matrix, or any other data type than data.frame.

3 pts, R-code

  • Paste the R-code you used to read the data into R.

Question 2

2 pts, numeric answer

  • The data.frame my_data that you created has ________ rows and ________ columns.

Question 3

“Your data are important.” - Gardener 2014

2 pt, short answer

  • Summarize the data-recording format that Gardener describes in chapter 2.
  • Make sure you describe what type of information is shown in the rows and what type of data is represented by columns.

Question 4

“Your data are important.” - Gardener 2014

2 pt, short answer

  • Briefly describe two reasons that it is important to arrange your data in row-format, i.e. Gardener’s scientific layout.

Question 5

“R has extensive help.” - Gardener 2014

2 pt, short answer

  • Name 2 sources of help for an unfamiliar R command.

Question 6

1 pt, multiple choice

  • Which is the correct R function to read a data file in comma-separated-values format into a data.frame object in R?

Submit to Moodle

These questions are for your reference, the same questions will appear in the assignment page on Moodle.

You should do your work outside of Moodle, saving your answers in a document and/or R script file.

When you are ready to submit your answers, you can paste your complete responses in the corresponding Moodle question entries for the assignment.