Module # 12 R Markdown
---
title: "Markdown Assignment for LIS4370"
author: "Issaiah Jennings"
date: "2025-04-13"
output: html_document
---
## Introduction
In this project, I worked on functions that help analyze student grade data. I used R to build functions that calculate averages, give letter grades, and filter students who are doing well. This file explains what each function does, how it works, and includes example code.
---
## Function 1: `average_grade()`
**What it does:**
Takes a list of grades and gives back the average.
**Inputs:**
- A vector of numbers (grades)
**Outputs:**
- One number (the average)
**Code:**
```{r}
average_grade <- function(grades) {
return(mean(grades, na.rm = TRUE))
}
# Example
average_grade(c(90, 85, 88)) # 87.67
average_grade(c(100, 95, NA, 85)) # 93.33
Function 2: get_letter_grade()
What it does:
Turns a number grade into a letter grade.
Inputs:
-
A number (like 87.67)
Outputs:
-
A letter (like "B")
Code:
Function 3: filter_high_performers()
What it does:
Keeps only students who scored above a certain average.
Inputs:
-
A data frame with a column called
average -
A number (threshold)
Outputs:
-
A smaller data frame with students who passed the threshold
Code:
R Markdown made it easy to keep my code, notes, and examples all in one place. I didn’t need to switch between files. I could just write and run everything here.
This file shows the three main functions I used for my grade analysis project. It’s clean and easy to read, and it’ll be helpful when I post it on GitHub. This was a good way to get better at coding and documenting my work.
https://github.com/Ijennin/R-Functions/blob/main/Grade_Average_Calculator.Rmd
Comments
Post a Comment