Iterate Calculations for Multiple Data Tables to New Data Table

Computer rounding error? If so would some students also get a slightly lower letter grade?

Mind, I have always thought that letter grades were dubious.

Oh well, back to the drawing board.

Any better?
You can look at other ranges that do not fall into the predefined letter categories simply by changing the break points in the cut statement.

library(tidyverse); library(reshape2); library(lubridate);
## read data in as a tibble

dat1 <- read_csv("grades1819.csv")

dat1 <- rename(dat1,
                 ID = student.enrollmentID,
                 gender = student.gender,
                 grade = student.grade,
                 course_no = grading.courseNumber,
                 course_name = grading.courseName,
                 teacher = grading.teacherDisplay,
                 term = grading.termName,
                 letter_grd = grading.progressScore,
                 percent = grading.progressPercent,
)

# ID is not a numeric so I converted it to "character".
dat1$ID  <-  as.character(dat1$ID)
##-------------------------------------------------------------------------

library(dplyr) # Probably redundant but too tired to check
library(janitor)

dat3  <-  dat1  %>%  
             select(term,  course_no, percent)
  
tt  <-  dat3    %>%  
         mutate(letter=cut(percent, breaks=c(-Inf, 59.5, 69.49, 79.49, 89.5, Inf), 
                                  labels=c("F","D","C", "B", "A")))  
  
letter_grades  <-   tt   %>%  tabyl(course_no, letter, term)

Excuse the crappy code I was futzing around with the cut statement and ran out of time.

Best wishes for the new year.
john

No computer error. If a student has worked very hard but some assessment has led to a B+ instead of an A-, the teacher might manually bump their transcript grade, etc. This happens on a few occasions per teacher, per class.

At any rate, thank you for the code. I am off the computer for a couple days so I will try this out on Monday.

Happy New Year!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.