Assignment: Input and Output of Data

This assignment introduces you to data input and output with R and will strengthen your skills in work directory management.

After completion you should be able to read in .csv files into R, access the contained data, and write out R objects as files to your local computer. You will further have reinforced your skills for running commands within R scripts, for compiling documents with R markdown, and for using Git and GitHub.

Things you need for this assignment

  • R — the interpreter can be installed on any operation system.
  • RStudio — we recommend to use R Studio for (interactive) programming with R.
  • Git environment for your operating system.
  • The Data input and output tutorial for this course.
  • An input .csv file, which will be provided by the instructor.

Data input and output assignment

  1. Work yourself through the data input and output tutorial, which you can find here.
  2. Download the .csv file and save it into your local “data” folder.

Please write an R script as an Rmd file with html output for the following tasks:

  1. Read in the data contained in this .csv file into R as an R data.frame object in the R workspace.
  2. What are the data types of each column?
  3. Save the column entitled “error” as a vector object in the R workspace.
  4. Remove all rows with values larger than 1 in the “error” column and save the result as a new R object.
  5. Write out this cleaned object to your local “output” folder as a new .csv file.

Save your Rmd file in your course repository, knitr it, update (i.e. commit) your local repository and publish (i.e. push) it to the GitHub classroom. Make sure that the created html file is also part of your GitHub repository and also include the text of each task prior to your solutions.

This assignment will NOT be marked. Note, however, that you will be hopelessly lost in the subsequent sessions if you have neither control over your work environment nor data input and output.