Packages

The is a glossary of all the package we cover in the course, and all the functions that appear in the tutorials and exercise.

base

head() - returns the top part of a data structure; we use it to print the entire part of a data frame.


dplyr

arrange() - sort the rows of a data frame according to the ordering of one or more columns.

filter - grab all rows from a data frame based on certain criteria, usually involving columns from that dataframe.

lag() - takes in a vector, shifts the elements downward, and then returns the shifted vector; useful for vectorized calculations such as daily returns.

mutate() - adds a column to a data frame; the new column is typically a function of one or more existing columns.

select() - select one or more columns of a data frame.

summarize() - perform a summarizing calculation that takes in one or more columns of a data frame and returns a single value; often used in conjunction with group_by().


ggplot2

ggplot() - generates a new plot; run this at the beginning of every code block that creates a graph.

geom_line() - used in conjunction with ggplot() to generate a line graph.


lubridate


magrittr

%>% - the pipe operator allows for convenient, left-to-right, function composition.


readr

read_csv() - read the contents of a CSV into a data frame.

write_csv() - write the contents of a data frame to a CSV file.


tibble

tibble() - use this to manually create a data frame.


tidyquant

tq_get() - download data from a variety of online sources; in this class we use it to grab data from Yahoo Finance.


utils

View() - look and object in the viewer; for data frames this gives you spreadsheet like look at the data. You can also envoke the viewer by putting your cursor on a variable and pressing F2.