This lesson is being piloted (Beta version)

R for Social Scientists: Glossary

Key Points

Before we Start
  • Use RStudio to write and run R programs.

  • Use install.packages() to install packages (libraries).

Introduction to R
  • Access individual values by location using [].

  • Access slices of data using [low:high].

  • Access arbitrary sets of data using [c(...)].

  • Use logical operations and logical vectors to access subsets of data.

Starting with Data
  • Use read_csv to read tabular data in R.

  • Use factors to represent categorical data in R.

Introducing dplyr and tidyr
  • Use the dplyr package to manipulate dataframes.

  • Use select() to choose variables from a dataframe.

  • Use filter() to choose data based on values.

  • Use group_by() and summarize() to work with subsets of data.

  • Use mutate() to create new variables.

  • Use the tidyr package to change the layout of dataframes.

  • Use gather() to go from wide to long format.

  • Use spread() to go from long to wide format.

Data visualisation with ggplot2
  • ggplot2 is a flexible and useful tool for creating plots in R.

  • The data set and coordinate system can be defined using the ggplot function.

  • Additional layers, including geoms, are added using the + operator.

  • Boxplots are useful for visualizing the distribution of a continuous variable.

  • Barplot are useful for visualizing categorical data.

  • Faceting allows you to generate multiple plots based on a categorical variable.

Glossary

FIXME