-
Notifications
You must be signed in to change notification settings - Fork 2
/
Assign01Marker.R
70 lines (46 loc) · 2.33 KB
/
Assign01Marker.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# This file is used to mark stats220 assginment (checking html):
# To use this file, you need to install "tidy HTML" first in you system
# Create a project and add this file within same folder as your project
# All students submission I saved it into the subfolder "submission", if you don't use same folder name, please change it accordingly.
# Read your student list
student.df <- read.csv("A1-marks-c-1.csv", header = TRUE, stringsAsFactors = FALSE)
# Get total student number
std.num<- nrow(student.df)
# Initialze the output dataframechro
mark.df <- data.frame(matrix(vector(), ncol = 9))
colnames(mark.df) <- names(student.df)
#Running through each student and enter the marks for them
for (i in 1:std.num){
student<- student.df[i, ]
studentname <- student[1]
stdId <- student[2]
cat("You are now marking ", as.character(studentname))
#Use mac preview to check the apprearence
previewcmd <- paste("qlmanage -p lab01error/*",stdId,"*", sep = "")
system(previewcmd)
# Enter appearence mark: 3 marks
mark01 = as.numeric(readline(prompt = "Enter appearance marks (6 marks total) --> "))
# Open student's file checking layout, please CHANGE THE FOLDER NAME, if you save submissions in different folder
opencmd <- paste("open ","lab01error/*",stdId,"*", sep = "")
system(opencmd)
## Enter Css marks
mark02 = as.numeric(readline(prompt = "Enter the Css controling repetition marks (2 marks total) --> "))
# Enter indention mark: 3 marks
mark03 = as.numeric(readline(prompt = "Enter Indentation marks (3 marks total)--> "))
## Enter the validation marks
mark04 = student.df$Validation..2.marks.[i]
#Enter comment marks: total 2 marks.
mark05 = as.numeric(readline(prompt = "Enter comment marks (2 marks total) --> "))
#Calculate the toal marks
total = sum(mark01, mark02, mark03, mark04,mark05)
# Add the marks into the csv file
student[3:8] <- c(mark01, mark02, mark03, mark04, mark05, total)
# Ask if the marker wants to add comments to the stuent
comments <- readline(prompt = "Any comments for this student? --> ")
student[9] <- comments
mark.df[i,] <- student
print("Student is been marked, details as follows")
print(mark.df[i,])
}
##Export your marks to csv file
write.table(mark.df, "/Users/Joy/Documents/UoA/A1-marks-c-1.csv", row.names = FALSE, sep = ",")