You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.5 KiB
39 lines
1.5 KiB
repeat {
|
|
c_samno <- sample(1:nrow(c_tweets), 1)
|
|
c_samtext <- as.character(c_tweets$text[c_samno])
|
|
c_samissue <- as.character(c_tweets$issue[c_samno])
|
|
c_samtags <- as.character(c_tweets$tags[c_samno])
|
|
c_samid <- as.character(c_tweets$id_str[c_samno])
|
|
|
|
|
|
repeat {
|
|
cat("===================\n\n[TWEET]: ",c_samtext,"\n", "[ISSUES]: ", c_samissue, " (", c_samtags, ")", sep="")
|
|
c_yn <- readYN("Is the categorization correct AND complete?\nEnter y or n: ")
|
|
|
|
# Check if input is correct
|
|
if(c_yn == "y" || c_yn == "n" || c_yn == "QUIT") {break} else {cat("Wrong input, please enter y or n (or QUIT if you want to exit safely).\n")}
|
|
}
|
|
|
|
# Exit codes:
|
|
# 0 = Correct tagging
|
|
# 1 = At least one tag was incorrect
|
|
# 2 = At least one tag was missing
|
|
# 3 = Both 1 and 2
|
|
|
|
if(c_yn == "y") {
|
|
c_result <- str_c("\"",c_samid,"\"",",0,","\"",c_samissue,"\",\"",c_samtags,"\",\"",c_samtext,"\"")
|
|
write(c_result, file = "issuecomp-codingsample-correct.csv", append = T)
|
|
}
|
|
else if(c_yn == "n") {
|
|
repeat {
|
|
c_err <- readYN("Enter 1 if a tag is incorrect, 2 if a tag is missing, and 3 if a tag is incorrect AND missing: ")
|
|
if(c_err == "1" || c_err == "2" || c_err == "3") {break} else {cat("Wrong input, please enter 1, 2 or 3.\n")}
|
|
}
|
|
c_result <- str_c("\"",c_samid,"\",",c_err,",\"",c_samissue,"\",\"",c_samtags,"\",\"",c_samtext,"\"")
|
|
write(c_result, file = "issuecomp-codingsample-error.csv", append = T)
|
|
}
|
|
else {
|
|
cat("Quitting now.")
|
|
break
|
|
}
|
|
} |