Set the working directory:

  1. Download “StudentSurvey.csv” to your computer.
  2. Set Working directory to the folder you saved your file in.
  3. read the file using read.csv command.
#If your assignment does not render, you might need to install.packages("htmltools")
library(readr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Instructions:

Read the StudentSurvey into this markdown and answers the following questions

#read the StudentSurvey.csv in here

student_survey <- read_csv("StudentSurvey.csv")
## Rows: 79 Columns: 17
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr  (5): Year, Sex, Smoke, Award, HigherSAT
## dbl (12): Exercise, TV, Height, Weight, Siblings, BirthOrder, VerbalSAT, Mat...
## 
## ℹ 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.
student_survey <- student_survey |> mutate(Sex = factor(Sex)) |> mutate(HigherSAT = factor(HigherSAT))

Check the data structure:

#check the head of the data set

head(student_survey)
## # A tibble: 6 × 17
##   Year      Sex   Smoke Award   HigherSAT Exercise    TV Height Weight Siblings
##   <chr>     <fct> <chr> <chr>   <fct>        <dbl> <dbl>  <dbl>  <dbl>    <dbl>
## 1 Senior    M     No    Olympic Math            10     1     71    180        4
## 2 Sophomore F     Yes   Academy Math             4     7     66    120        2
## 3 FirstYear M     No    Nobel   Math            14     5     72    208        2
## 4 Junior    M     No    Nobel   Math             3     1     63    110        1
## 5 Sophomore F     No    Nobel   Verbal           3     3     65    150        1
## 6 Sophomore F     No    Nobel   Verbal           5     4     65    114        2
## # ℹ 7 more variables: BirthOrder <dbl>, VerbalSAT <dbl>, MathSAT <dbl>,
## #   SAT <dbl>, GPA <dbl>, Pulse <dbl>, Piercings <dbl>
#check the dimensions

dim(student_survey)
## [1] 79 17
#create a table of students'sex and "HigherSAT"

xtabs(~ Sex + HigherSAT, data=student_survey)
##    HigherSAT
## Sex Math Verbal
##   F   25     15
##   M   24     15
# Display summary statistics for VerbalSAT

summary(student_survey$VerbalSAT)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   420.0   550.0   580.0   583.2   630.0   720.0
#Find the average GPA of students

mean(student_survey$GPA)
## [1] 3.169114
#Create a new dataframe, call it "column_df". This new dataframe should contain students' weight and number of hours the exercise 

column_df <- student_survey[, c("Weight", "Exercise")]
#Access the fourth element in the first column from the StudentSurvey's dataset.

student_survey[4,1]
## # A tibble: 1 × 1
##   Year  
##   <chr> 
## 1 Junior