#Install open intro package
#install.packages("openintro")
#Install tidyverse
#install.packages("tidyverse")
#Open the libraries
library(tidyverse)
## -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
## v ggplot2 3.3.5 v purrr 0.3.4
## v tibble 3.1.4 v dplyr 1.0.7
## v tidyr 1.1.3 v stringr 1.4.0
## v readr 2.0.1 v forcats 0.5.1
## -- Conflicts ------------------------------------------ tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(openintro)
## Loading required package: airports
## Loading required package: cherryblossom
## Loading required package: usdata
#Find out what the default working directory is
getwd()
## [1] "C:/Users/Haley/Desktop/INST314/Labs/Lab_0"
#assigning a value to variable
x <- 42
x
## [1] 42
#numeric and alphabetical vectors
num_vector <- c(1,2,3)
char_vector <- c("a", "b", "c")
# Declare variables of different types
my_numeric <- 42
my_character <- "universe"
my_logical <- FALSE
# Check class of my_numeric
class(my_numeric)
## [1] "numeric"
# Check class of my_character
class(my_character)
## [1] "character"
# Check class of my_logical
class(my_logical)
## [1] "logical"
#Entering in data
typos = c(2,3,0,3,1,0,0,1)
typos
## [1] 2 3 0 3 1 0 0 1
mean(typos)
## [1] 1.25
median(typos)
## [1] 1
max(typos)
## [1] 3