# Enter your name here: Kyle Chouinard
# 2. I did this homework with help from the book and the professor and these Internet sources:https://www.youtube.com/watch?v=o_ldRKmgvHo
Define a variable:
x <- 5
Define the following vectors, which represent the population (in thousands) and number of colleges in each of the five counties in Central New York (CNY) – Cayuga, Cortland, Madison, Onondaga, and Oswego, in this order:
population <- c(80, 49, 73, 467, 122)
colleges <- c(2, 2, 3, 9, 2)
length(population)
## [1] 5
#Population length is 5
length(colleges)
## [1] 5
#Colleges length is 5
mean(population)
## [1] 158.2
#Mean population is 158.2
mean(colleges)
## [1] 3.6
#Mean colleges is 3.6
sum(population)
## [1] 791
#Sum of population is 791
sum(colleges)
## [1] 18
#Sum of colleges is 18
sum(population)/length(population)
## [1] 158.2
#The average population is 158.2
sum(colleges)/length(colleges)
## [1] 3.6
#Average number of colleges is 3.6
max(colleges)
## [1] 9
#Onondaga County has the most colleges
min(population)
## [1] 49
#Cortland has the lowest population
range(population)
## [1] 49 467
#Cortland is the least populous, Onondaga is the most
extrapop <- (colleges+50)
mean(extrapop)
## [1] 53.6
#Mean of ExtraPop is 53.6
BigCoutnies <- population[c(4,5)]
length(BigCoutnies)
## [1] 2
#Length of BigCounties is 2