0. The Basics of R: Using R
Working with data frames
The following video explains how you can get data into R when it is stored in a data file. The data file that is used in this video (BikeData.csv) is available here. Download this file and save it on your desktop before watching the video.
When watching the video, make sure to repeat all the steps that are explained yourself in RStudio.
Continuing from the previous video, the next one explains how you can interact with your data set after you have loaded it and have it available in R as a data frame. Watch the video and (again) repeat the steps yourself that are explained.
Keypoints
You are now familiar with:
- loading a csv-file into RStudio as a dataframe
- the general layout of a data frame, with one case per row and one variable per column
- opening a spreadsheet view of a dataframe by clicking on the object in the Environment (or using the
View( )
command in the console) - selecting a variable from a dataframe via the
$
sign, which returns a vector - selcting cases (rows) and variables (columns) from a dataframe via indexing within square brackets (
[,]
) - applying the function
table()
to categorical vectors, to generate a frequency table (= a count the number of cases per category)
Unlock full access