We assume that you all have some degree of experience with R in your bachelor studies. However, if you are completely new to R or if you haven’t used R for a long time, we recommend that you watch these videos as a refresher.

Introduction to RStudio from MarinStats

Download and Install R & RStudio from MarinStats

Simple Arithmetic in R from MarinStats

1.2 Importing and Exporting Data

One of the most common, beginner problems that we run into is loading the data in R. Most of these problems arise because there are different functions we need to use for different file types.

Read this chapter from the STHDA wiki page on Importing Data into R, which provides an excellent overview of the different functions to import data from txt, csv and Excel into R and also explanations on how to use them.

Tip 1: Focus on the chapters Fast Reading of Data From txt|csv Files into R: readr package and Reading data From Excel Files (xls|xlsx) into R, as these are the most common data files that you will be encountering throughout your R journey!

Tip 2: Use the Cheatsheets! They are a great way of quickly looking for a function you need. Click here to download the the cheatsheet for Data Import with readr.

Assignment

We have uploaded a file on Github called Tourismus, which is a data set from Basel City on Tourism from foreign countries.

Inspect the dataset and answer the questions using functions. What does each column show? How many rows are there? Which country had the highest number of tourists? Note. If you get stuck or don’t know where to start, make sure to look at the Useful Links and Resources that we have compiled for you, which you can find on the homepage.