Posts

Final project - create your own R Package

Final project - create your own R Package Issaiah Jennings  In this blog post, I’ll walk you through how I created an R package, combinePredictR, to analyze the 2019 NFL Combine data. This package includes functions for cleaning, visualizing, and summarizing key player statistics, such as the 40-yard dash time. Along the way, I’ll explain the steps I took, the challenges I encountered, and how I addressed them.  Step 1: Setting Up the Package I started by setting up my R package using usethis and devtools, which are great tools for package development in R. Here's a quick rundown of what I did: I used the usethis::create_package() function to initialize the basic structure of the package. I created a new R script for each function: clean_combine_data.R: For data cleaning. plot_40yd_by_position.R: To plot the 40-yard dash times by player position. summarize_40yd_by_position.R: To create a summary table showing average, minimum, and maximum times by position. Step 2: Cleani...

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

Module # 11 Debugging and defensive programming in R

Issaiah Jennings Module # 11 Debugging and defensive programming in R The code below contains a 'deliberate' bug! tukey_multiple <- function(x) { outliers <- array(TRUE,dim=dim(x)) for (j in 1:ncol(x)) { outliers[,j] <- outliers[,j] && tukey.outlier(x[,j]) } outlier.vec <- vector(length=nrow(x)) for (i in 1:nrow(x)) { outlier.vec[i] <- all(outliers[i,]) } return(outlier.vec) } > Find the bug and fix it. tukey_multiple <- function(x) { outliers <- array(TRUE, dim = dim(x)) for (j in 1:ncol(x)) { outliers[, j] <- outliers[, j] & tukey.outlier(x[, j]) } outlier.vec <- vector(length = nrow(x)) for (i in 1:nrow(x)) { outlier.vec[i] <- all(outliers[i, ]) } return(outlier.vec) } I fixed a bug in the tukey_multiple function. I was using && for comparisons, but I needed & instead. After the fix, the function worked correctly.

Module # 10 Building your own R package

Issaiah Jennings Module # 10 Building your own R package Package: Jennings Title: Data Visualization Tools Version: 0.0.0.9000 Authors@R: Authors@R: c(person("Issaiah", "Jennings", email = "icarterjennings@usf.edu", role = c("aut", "cre"))) Description: A package for creating data visualizations using base R, lattice, and ggplot2.  It helps users generate clear and effective plots for data analysis Depends: R (>= 3.1.2) License: CC0 LazyData: true The Jennings package is for students and anyone looking to make data visualizations in R without too much hassle. It includes simple functions to create plots using base R, lattice, and ggplot2, so you can explore different styles without switching tools. This package is meant to make it easier to generate clear, professional-looking charts for class projects, research, or personal data analysis. https://github.com/Ijennin/R-Functions/blob/278e176fbbe3209edd5ff5fc5bd9d03df49e5145/Module%20...

Module # 9 Visualization in R

Image
Issaiah Jennings Module # 9 Visualization in R In this project, I explored the ShipAccidents.csv dataset and created three visualizations in R: a basic histogram, a bar plot using Lattice , and a customized bar chart with ggplot2 . The first visualization I made was a basic histogram showing the distribution of ship service years . This quick and simple plot helped me understand how service years are spread out across ships. It was useful for spotting extreme values, but it lacks customization options, making it more suitable for initial exploration rather than detailed analysis. Next, I used Lattice to create a bar plot showing the number of incidents by ship type . This method helped me categorize the incidents by ship type, offering a clear visual of which ship types have more accidents. While Lattice is great for grouped data, it’s less flexible in terms of customization compared to ggplot2 . Finally, I used ggplot2 to create another bar chart of incidents by ship type, bu...

Module # 8 Input/Output, string manipulation and plyr package

Image
Issaiah Jennings Module # 8 Input/Output, string manipulation and plyr package For this assignment, I worked with a dataset containing student information such as their name, age, sex, and grade. The first thing I did was import the data from a .txt file on my Desktop into R using the read.delim() function. Once the data was in R, I renamed the columns for clarity so they were easier to work with. After that, I used the plyr package to calculate the average grade based on gender by grouping the data by the "Sex" column and applying the mean() function. Next, I filtered the data to only include students whose names contained the letter "i," using the grepl() function. Finally, I saved the results of the mean grade calculation into a text file and exported the filtered student names to a CSV file, which I saved on my Desktop. > # Install and load required packages > library(plyr) > > # Read the dataset with read.delim() assuming it's tab-separated ...

Module # 7 R Object: S3 vs. S4 assignment

Issaiah Jennings Module # 7 R Object: S3 vs. S4 assignment In this blog, I will walk through a practical example of using object-oriented systems (S3 and S4) in R. > # Step 1: Load and View the Dataset > data("mtcars")   > head(mtcars, 6)                      mpg cyl disp  hp drat    wt  qsec vs am gear carb Mazda RX4         21.0   6  160 110 3.90 2.620 16.46  0  1    4    4 Mazda RX4 Wag     21.0   6  160 110 3.90 2.875 17.02  0  1    4    4 Datsun 710        22.8   4  108  93 3.85 2.320 18.61  1  1    4    1 Hornet 4 Drive    21.4   6  258 110 3.08 3.215 19.44  1  0    3    1 Hornet Sportabout 18.7   8  360 175 3.15 3.440...