Checking the Dataset Conformity in R

Viewed 16

Sorry i’m new to R. So i have an academic data frame. I have 3 columns named “Student name”, “Final score”, and “Grade”. And there is a certain grade range of the final score exam. Score >=80 is considered grade A.

My question is how do i compare the number of the students who got an A with the number of students who got a final score >=80. The opeation has to be yield a logical value.

1 Answers

If I understood correctly your question, maybe you can try this:

One option is to have the frequencies of the column “Final score”

table(dataframe$`Final score`)

A second option is to add a new column and count the frequencies based on a particular condition.

library(dplyr)

df <- df %>% 
       mutate(status = ifelse(`Final score` >=80), "Grade A", "No Grade A") %>% 
       group_by(status) %>%
       summarize(frequency = n())
Related