Skip to content

Data Types

Cghlewis edited this page May 9, 2024 · 57 revisions

Some of the most common variable classes you will encounter include:

  • Character
  • Numeric (Double)
  • Integer
  • Factor
  • Date
  • POSIXt
  • Logical

And common data types include:

  • Character
  • Numeric (Double)
  • Integer
  • Logical

Review variable structure

Convert variable class

Convert variable class using a dictionary


Main functions used in examples

Package Functions
base class(); typeof(); as.factor(); as.numeric(); as.character()
utils str()
lubridate as_date(); as_datetime(); mdy(); parse_date_time()
forcats as_factor(); fct_relevel()
janitor excel_numeric_to_date()
dplyr glimpse()

Other functions used in examples

Package Functions
base attributes(); levels()
dplyr mutate(); across(); all_of(); pull()
purrr map()
tidyselect everything(); where()

Resources