Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Grades Summary | Factors
R Introduction: Part I

book
Grades Summary

Taak

Swipe to start coding

You have already created a factor vector, grades_f, which assigns each numeric grade into one of five categories ('F', 'D', 'C', 'B', 'A'). Your goal is to:

  1. Call the summary() function on your grades_f variable to output the number of occurrences of each factor grade.
  2. Divide those counts by the total number of grades, computed by calling length() function on grades_f variable, to obtain the relative frequency of each grade.

Oplossing

# Vector of grades
grades <- c(96,84,67,78,61,74,93,77,74,82,83,79,61,23,76,79,79,73,
75,81,65,85,29,79,70,76,75,80,66,72,88,87,86,93,70,88,
67,76,69,84,85,59,82,76,67,75,80,75,79,86)
# Cut the grades into five intervals
grades_f <- cut(grades, breaks = c(0, 60, 75, 85, 95, 100),
labels = c('F', 'D', 'C', 'B', 'A'),
ordered_result = T, right = F)
# Show the summary of grades
summary(grades_f)
# Calculate the proportion of each grade
summary(grades_f)/length(grades_f)
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 3. Hoofdstuk 6
# Vector of grades
grades <- c(96,84,67,78,61,74,93,77,74,82,83,79,61,23,76,79,79,73,
75,81,65,85,29,79,70,76,75,80,66,72,88,87,86,93,70,88,
67,76,69,84,85,59,82,76,67,75,80,75,79,86)
# Cut the grades into five intervals
grades_f <- cut(grades, breaks = c(0, 60, 75, 85, 95, 100),
labels = c('F', 'D', 'C', 'B', 'A'),
ordered_result = T, right = F)
# Show the summary of grades
___(___)
# Calculate the relative frequency of each grade
___(___)/___(___)

Vraag AI

expand
ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

some-alt