3
I am wanting to create a function to control the students' grades. I am 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 is this:
Data frame format.:
Registration 1st Event 2nd Event 3rd Event Average Event Final Average Final
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º) Average the three tests;
3º) Generate a new column where:
If the average is greater than or equal to 7 the result would be Approved (if possible color of the blue text) and in this case (average>=7) already put the result in the column Final Mean
If the average 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 Failed (red text color)
4º) In case the student goes to the Final Test, calculate the Final Average in which (Média*0,6)+(Prova Final*0,4)
and if the note is higher than 5 the result is Approved (blue text color) otherwise Disapproved (red text color) and put the result in the Final Media column
Someone would know how to do that?
Some additional information: In the example I invented the grades of four students, one for each possible case. The first was approved direct, the second failed direct, and the other two went to Pfinal, the first approved and the second failed.
– Molx