YouTube R Programming: Introduction: Data Frames (R Intro-03)

Nicole Seaman

Director of CFA & FRM Operations
Staff member
Subscriber
Data frames are the most common structure in R. A data frame is a list of equal-length vectors; ie, it's a rectangle. Create a data frame with data.frame(). Single-brackets, stocks[1], returns a dataframe. Double-brackets, stocks[[1]], returns a vector and is equivalent to stocks$ticker. We can use matrix notation; e.g., stocks[2:4, 1:2]. From the tidyverse is the tibble, which is a more convenient dataframe. A tibble is still a dataframe, but it is also class tibble and has advantages: 1. It does not change inputs, we do not need the irksome stringsAsFactors = FALSE; 2. We can create list columns inside "on the fly" in a tibble; 3. Lazy arguments are allowed; and 4. Tibble printout is better.

David's R notebook file script is here https://github.com/bionicturtle/youtube/tree/master/r-intro


YT sub small.png
 
Last edited:
Top