-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloadAllAnswers.R
41 lines (30 loc) · 1.28 KB
/
loadAllAnswers.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#Load ALL Answers into a dataframe
#NO FILTERING of WORKERS
loadAnswers<- function(fileName){
setwd("C://Users//Christian//Documents//GitHub//ML_VotingAggregation//");
data_all <- read.csv(fileName,header = TRUE,sep=",");
dataf = data.frame(data_all);
#summary(dataf)
#First I need to look at the outliers or invalid values
#Invalid age and invalid years of experience
#Remove rows with empty data
#dataf <- dataf [!(dataf$Worker.age==0),];
#Remove confidence level zero (because it is associated with IDK answers)
#dataf <- dataf [!(dataf$Answer.confidence==0) ,];
#dataf <- dataf [!(dataf$Answer.confidence==3) ,];
#Remove NO AND IDK ANSWERS
#dataf <- dataf [!(dataf$Answer.option=="IDK") ,];
# dataf <- dataf [!(dataf$Answer.option=="YES") ,];
#Remove invalid values
#dataf <- dataf [!dataf$Worker.age <1,];
#dataf <- dataf [!dataf$Worker.yearsOfExperience <1,];
#Outliers
#Assuming that the youngest age to start programming is 10 years old
#Remove inputs for which age-YoE<5
#dataf <- removeLinesColDiffSmallerThanValue(dataf,7,5,10)
#summary (dataf);
#create column with 1 for YES and 0 for NO or IDK
dataf$Answer.reward[dataf$Answer.option=="YES"] <- 1
dataf$Answer.reward[dataf$Answer.option!="YES"] <- 0
return(dataf);
}