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
stsry <- read.csv("C:/PMS/Data_Science/Data101/Week1_a/HW/StudentSurvey.csv")

Check the data structure:

#check the head of the data set
head(stsry)
##        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
#str(strsy$Year)
#str(strsy$Sex)
#str(strsy$Smoke)
#str(strsy$Award)
#str(strsy$HigherSAT)
#str(strsy$Exercise)
#str(strsy$TV)
#str(strsy$Height)
#str(strsy$Weight)
#str(strsy$Siblings)
#str(strsy$BirthOrder)
#str(strsy$VerbalSAT)
#str(strsy$MathSAT)
#str(strsy$SAT)
#str(strsy$GPA)
#str(strsy$Pulse)
#str(strsy$Piercings)
#check the dimensions
dim(stsry)
## [1] 79 17
#create a table of students'sex and "HigherSAT"
table(stsry$Sex, stsry$HigherSAT)
##    
##     Math Verbal
##   F   25     15
##   M   24     15
# Display summary statistics for VerbalSAT
summary(stsry$VerbalSAT)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   420.0   550.0   580.0   583.2   630.0   720.0
mean(stsry$VerbalSAT)
## [1] 583.1646
sd(stsry$VerbalSAT)
## [1] 60.98643
var(stsry$VerbalSAT)
## [1] 3719.344
range(stsry$VerbalSAT)
## [1] 420 720
#Find the average GPA of students
mean(stsry$GPA)
## [1] 3.169114
sd(stsry$GPA)
## [1] 0.4135655
var(stsry$GPA)
## [1] 0.1710364
range(stsry$GPA)
## [1] 2.09 4.00
#Create a new dataframe, call it "column_df". This new dataframe should contain students' weight and number of hours the exercise 

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
column_df <- stsry[, c("Weight" , "Exercise")]
#Access the fourth element in the first column from the StudentSurvey's dataset.

stsry[4, "Year"]
## [1] "Junior"