Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create an R script to answer 8(a)-(c). For 8(c) use R comments (i.e., using \"#\

ID: 3745046 • Letter: C

Question

Create an R script to answer 8(a)-(c). For 8(c) use R comments (i.e., using "#") for your answer.

8. This exercise relates to the College data set, which can be found in the file College.csv. It contains a number of variables for 777 different universities and colleges in the US. The variables are Private : Public/private indicator Apps : Number of applications received Accept: Number of applicants accepted Enroll Number of new students enrolled . Top10perc : New students from top 10% of high school class . Top25perc : New students from top 25% of high school class F.Undergrad : Number of full-time undergraduates P.Undergrad: Number of part-time undergraduates Outstate : Out-of-state tuition Room.Board Room and board costs Books: Estimated book costs Personal Estimated personal spending PhD Percent of faculty with Ph.D.'s Terminal : Percent of faculty with terminal degree S.F.Ratio : Student/faculty ratio perc.alumni : Percent of alumni who donate Instructional expenditure per stu dent e Grad.Rate Graduation rate Before reading the data into R, it can be viewed in Excel or a text editor (a) Use the read.csv) function to read the data into R. Call the loaded data college. Make sure that you have the directory set to the correct location for the data. b) Look at the data using the fix) function. You should notice that the first column is just the name of each university. We don't really want R to treat this as data. However, it may be handy to have these names for later. Try the following commands:

Explanation / Answer

##a.. Read data in R##

###Set the working directory to the file location##
setwd("C:/Users/saurabh.jha/Downloads")

##Read csv file, provide stringsAsFactors = FALSE to make sure the string##
##data doesn't get converted into factors datatype##

college<-read.csv("College.csv",stringsAsFactors = FALSE)

###To see the data##
View(college)

##b..##
###Did as specified in problem statement##

rownames(college)=college[,1]
fix(college)

###Delete the first column##

college=college[,-1]
fix(college)

###c##
## i ##

summary(college)

##Output##

Private Apps Accept Enroll Top10perc   
Length:777 Min. : 81 Min. : 72 Min. : 35 Min. : 1.00  
Class :character 1st Qu.: 776 1st Qu.: 604 1st Qu.: 242 1st Qu.:15.00  
Mode :character Median : 1558 Median : 1110 Median : 434 Median :23.00  
Mean : 3002 Mean : 2019 Mean : 780 Mean :27.56  
3rd Qu.: 3624 3rd Qu.: 2424 3rd Qu.: 902 3rd Qu.:35.00  
Max. :48094 Max. :26330 Max. :6392 Max. :96.00  
Top25perc F.Undergrad P.Undergrad Outstate Room.Board  
Min. : 9.0 Min. : 139 Min. : 1.0 Min. : 2340 Min. :1780  
1st Qu.: 41.0 1st Qu.: 992 1st Qu.: 95.0 1st Qu.: 7320 1st Qu.:3597  
Median : 54.0 Median : 1707 Median : 353.0 Median : 9990 Median :4200  
Mean : 55.8 Mean : 3700 Mean : 855.3 Mean :10441 Mean :4358  
3rd Qu.: 69.0 3rd Qu.: 4005 3rd Qu.: 967.0 3rd Qu.:12925 3rd Qu.:5050  
Max. :100.0 Max. :31643 Max. :21836.0 Max. :21700 Max. :8124  
Books Personal PhD Terminal S.F.Ratio   
Min. : 96.0 Min. : 250 Min. : 8.00 Min. : 24.0 Min. : 2.50  
1st Qu.: 470.0 1st Qu.: 850 1st Qu.: 62.00 1st Qu.: 71.0 1st Qu.:11.50  
Median : 500.0 Median :1200 Median : 75.00 Median : 82.0 Median :13.60  
Mean : 549.4 Mean :1341 Mean : 72.66 Mean : 79.7 Mean :14.09  
3rd Qu.: 600.0 3rd Qu.:1700 3rd Qu.: 85.00 3rd Qu.: 92.0 3rd Qu.:16.50  
Max. :2340.0 Max. :6800 Max. :103.00 Max. :100.0 Max. :39.80  
perc.alumni Expend Grad.Rate
Min. : 0.00 Min. : 3186 Min. : 10.00  
1st Qu.:13.00 1st Qu.: 6751 1st Qu.: 53.00  
Median :21.00 Median : 8377 Median : 65.00  
Mean :22.74 Mean : 9660 Mean : 65.46  
3rd Qu.:31.00 3rd Qu.:10830 3rd Qu.: 78.00  
Max. :64.00 Max. :56233 Max. :118.00

## ii ##

##Scatterplot of first 10 numeric variables##
##Get column names by##
colnames(college)

##Draw the graph using pairs function##
##Graph header as Simple Scatterplot Matrix
##Concatenate variables by + operator

pairs(~Apps+Accept+Enroll+Top10perc+Top25perc+F.Undergrad+P.Undergrad+Outstate+Room.Board+Books,
  
data=college,main="Simple Scatterplot Matrix")


### iii Draw boxplot in R##
##See for two different values of Private and their corresponding Outstate##

boxplot(Outstate ~ Private, data = college, xlab = "Private",
ylab = "Outstate", main = "Private Outstate")


###For iv use the stated code in problem statement, summary and boxplot function used in my code above##

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote