I want to create a function to control students' grades. I'm trying the following function:
note_eng<-read.csv2("note.csv",header=TRUE)
note_eng$Média<-(note_eng[,1]+note_eng[,2]+note_eng[,3])/3
for(i in 1:length(note_eng$Média)){
if(note_eng$Média[i]>=7)
note_eng$Resultado[i]="Aprovado"
else
note_eng$Resultado[i]="Reprovado"
}
But what I would like would be the following:
Data.frame format:
Enrollment 1st Test 2nd Test 3rd Test Average Final Final Final Test
1) If the note of each proof is greater than or equal to 7 the color of the text would be blue while otherwise the color of the text would be red
2º) Calculate the average of the three tests;
3rd) Generate a new column in which:
If the mean is greater than or equal to 7 the result would be Approved (if possible blue text color) and in this case (mean > = 7) already put the result in the Final Average column
If the mean is greater than four and less than 7 the result would be Final Proof (black text color and yellow background)
If the average is less than four the result would be Disapproved (red text color)
4º) If the student goes to the Final Test, calculate the Final Average in which% with% and if the mark is greater than 5 the result is Approved (blue text color) otherwise Failed (red text color ) and put the result in the Final Average column
Would anyone know how to do this?