Exercise 1 (= exercise 6 from last time): a useful piece of code

Write a piece of R code that will do the following:

  • it will make a list of all the files available in a given subdirectory (e.g. "data"). Hint: use the list.files() command
  • It will loop over all these files (hint: use a for loop), and it will for each of them:
    • read the file
    • do some processing (e.g. draw a plot, calculate something, or summarize the content

As an example of files to process, you can use the data.zip file available on the Moodle website.

When this works, you can turn the code into a function, which will take one argument: the name of the directory to process.

Exercise 2

Load the files etudiants1.csv and etudiants2.csv and merge them.

Last modified: Monday, 2 December 2019, 10:34 AM