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")

Instructions:

Read the StudentSurvey into this markdown and answers the following questions

#read the StudentSurvey.csv in here

student_df<- read.csv("StudentSurvey.csv")

Check the data structure:

#check the head of the data set

top6 <- head(student_df)
top6
##        Year Sex Smoke   Award HigherSAT Exercise TV Height Weight Siblings
## 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
##   BirthOrder VerbalSAT MathSAT  SAT  GPA Pulse Piercings
## 1          4       540     670 1210 3.13    54         0
## 2          2       520     630 1150 2.50    66         3
## 3          1       550     560 1110 2.55   130         0
## 4          1       490     630 1120 3.10    78         0
## 5          1       720     450 1170 2.70    40         6
## 6          2       600     550 1150 3.20    80         4
#check the dimensions

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

table(student_df$Sex, student_df$HigherSAT)
##    
##     Math Verbal
##   F   25     15
##   M   24     15
# Display summary statistics for VerbalSAT

summary(student_df$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_df$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 <- c(student_df$Weight, student_df$Exercise); column_df
##   [1] 180 120 208 110 150 114 128 235 115 140 135 110  99 165 120 154 110 145
##  [19] 195 200 167 175 155 185 190 165 175 126 187 170 158 119 205 129 145 130
##  [37] 215 135 145  98 150 159 174 160 165 161 130 175 255 160 160  95 115 120
##  [55] 135 180 155 110 215 140 195 185 185 209 145 180 170 135 165 137 147 150
##  [73] 155 160 130 180 150 205 115  10   4  14   3   3   5  10  13  12  12   6
##  [91]  10   3   7   2  14  10  14  20   7  12  10   6  14  12  10   8   0  10
## [109]   6   5  24   2  10   6   5   5  12   2   7  15   5   7  15   8  14   4
## [127]  15   4  15   3   3  15  20   3   6  12   4  20  10  10   4   9  12   2
## [145]   2   5   5   6  10   4   5  17   7   2   8   1  14  12
#Access the fourth element in the first column from the StudentSurvey's dataset.

student_df[1,4]
## [1] "Olympic"