Que função é utilizada?

Que função permite se contar notas de alunos acima de um determinado valor dado ?

Here are two methods for counting grades >= 80.

DF <- data.frame(Student=c("A","B","C","A","B","C","D"),
                 Grades=c(78,85,62,91,81,79,90))
DF
#>   Student Grades
#> 1       A     78
#> 2       B     85
#> 3       C     62
#> 4       A     91
#> 5       B     81
#> 6       C     79
#> 7       D     90
#All grades
sum(DF$Grades >= 80)
#> [1] 4

#Summary for each student
library(dplyr)
GradeSummary <- DF %>% group_by(Student) %>% summarize(Above80=sum(Grades>=80))
#> `summarise()` ungrouping output (override with `.groups` argument)
GradeSummary
#> # A tibble: 4 x 2
#>   Student Above80
#>   <chr>     <int>
#> 1 A             1
#> 2 B             2
#> 3 C             0
#> 4 D             1

Created on 2021-08-24 by the reprex package (v0.3.0)

This topic was automatically closed 21 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.