Homework should be written as an R Markdown file and the knitted output should be submitted. Homework should be turned in on Sakai.

library(tidyverse)

  1. (4pts) Clone this repo into RStudio (if you haven’t done so yet): https://github.com/wabdalla/DSCI_101

Take a screenshot of your RStudio. You will get full credit if in the screenshot I see the class folders (under the files tab) and I see the git tab on the upper right window. For further instructions on how to include pictures, see the R Markdown cheat sheet.

screenshot of my rstudio
screenshot of my rstudio
  1. (3pts) Create a numeric vector containing the values 5, 10, 15, 20, and 25. Calculate the mean of this vector and assign it to a variable called mean_value. Print the mean_value
vector <- c(5 , 10 , 15 , 20)

mean_value <- mean(vector)
  1. (3pts) Create a data frame with the following information about three of your friends:

Make sure to include at least three rows of data. Print the entire data frame. Name it whatever you like.

Name <- c("Anoushka", "Rahee", "Leah")
Age <-c(18, 18, 19)
FavoriteColor <- c("green", "pink", "blue")

Friends <- data.frame(Name, Age, FavoriteColor) 
  1. (3pts) Create two numeric vectors: vector1 with values 1, 2, 3, and vector2 with values 4, 5, 6. Perform the following operations:

Print all four result vectors.

vector1 <- c(1,2,3)
vector2 <- c(4,5,6) 

sum_vector <-c(vector1+vector2)
diff_vector <-c(vector1-vector2)
prod_vector <-c(vector1*vector2)
quot_vector <-c(vector1/vector2)
  1. (12pts) Using the top_colleges_2022 dataset answer the following questions.
  1. Read in the csv file and name the variable college. This should be simple if question 1 has been completed as the github will download the data folder.
college <- readr::read_csv("C:/Users/emili/OneDrive/Desktop/DSCI_101/data/top_colleges_2022.csv")
## New names:
## Rows: 498 Columns: 25
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (13): description, organizationName, state...4, campusSetting, website, ... dbl
## (12): rank, studentPopulation, medianBaseSalary, longitude, latitude, ye...
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `state` -> `state...4`
## • `state` -> `state...14`
  1. How many colleges in this data set are in Illinois.

There are 16 colleges in Illinois in this data set.

Illinois_colleges <-stats::filter(college, "stateCode" == "IL")
  1. Find the undergraduate student population of LUC. How man colleges (in this dataset) have a larger undergraduate student population than LUC?

The undergraduate population of Loyola is 13878 according to the data set.

undergrad_pop <- filter(college, "undergradPop" > 13878)