forked from araiho/Intro_Biocomp_ND_317_Tutorial5
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExerciseScript5_2.R
More file actions
17 lines (17 loc) · 829 Bytes
/
Copy pathExerciseScript5_2.R
File metadata and controls
17 lines (17 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#Excercise5,Question2
wages<-read.csv(file="wages.csv",header=TRUE,stringsAsFactors = FALSE)
EliminateColumnThree=wages
#I copied the file to a new name to extract the data, but not lose the original data
EliminateColumnThree$yearsSchool<-NULL
#Deleted the third column
maxorderedwages<-EliminateColumnThree[order(-EliminateColumnThree$wage),1:3]
head(maxorderedwages,1)
#Gives the gender, yearsExperience, and wage for highest earner
minorderedwages<-EliminateColumnThree[order(EliminateColumnThree$wage),1:3]
head(minorderedwages,1)
#Gives the gender, yearsExperience, and wage for lowest earner
maxorderedwages<-EliminateColumnThree[order(-EliminateColumnThree$wage),1:3]
TenHighest<-head(maxorderedwages,10)
females<-TenHighest[TenHighest$gender=="female",]
nrow(females)
#Counts the number of females of the top ten earners