Working with and Visualizing Data in R: Glossary

Key Points

R Language Basics
  • R has the usual arithmetic operators and mathematical functions.

  • Use <- to assign values to variables.

  • Use ls() to list the variables in a program.

  • Use rm() to delete objects in a program.

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

  • Use library(packagename)to make a package available for use

  • Use help() to get online help in R.

Data Import
  • Use read_cvs to read in CSV files

  • Use read_tvs to read in TSV files

  • Use write_csv() and write_tsv() to write such files

  • Supply col_types to read functions in your script to insure consistancy

  • Use guess_encoding() to guess encoding of strings in old docs

Data Transformation
  • Read in a csv file using read_csv()

  • View a dataframe with View

  • Use filter() to pick observations by their values

  • Use arrange() to order the rows

  • Use select() to pick variables by their names

  • Use mutate() to create new variables with functions of existing variables

  • Use summarize() to collapse many values down to a single summary

Visualizing Data
  • Use ggplot2 to create plots.

  • Think about graphics in layers: aesthetics, geometry, statistics, scale transformation, and grouping.

Glossary

The glossary would go here, formatted as:

{:auto_ids}
key word 1
:   explanation 1

key word 2
:   explanation 2

({:auto_ids} is needed at the start so that Jekyll will automatically generate a unique ID for each item to allow other pages to hyperlink to specific glossary entries.) This renders as:

key word 1
explanation 1
key word 2
explanation 2