Posts

Showing posts from March, 2026

Assignment #10: Building Your Own R Package

The Friedman package is designed to help users clean, analyze, and model airline delay data. It is intended for students and analysts working with transportation datasets who want a simple and reusable way to explore delay patterns and trends. The package will include key functions such as clean_delay_data() for preparing datasets, summarize_delays() for calculating summary statistics, plot_delay_trends() for visualizing delay patterns, and predict_delays() for building basic predictive models. These functions support a complete workflow from data preparation to analysis. The DESCRIPTION file was structured to clearly define the package and its dependencies. The version 0.0.0.9000 indicates the package is still in development. The Authors@R field identifies the creator, while Depends specifies the required R version. The Imports field includes packages like dplyr and rlang for data manipulation. The CC0 license was chosen to allow open academic use, and the URL and BugReports fields li...

Assignment #9: Visualization in R – Base Graphics, Lattice, and ggplot2

Image
# Load dataset from Rdatasets collection data("iris", package = "datasets") head(iris) # Base R Graphics # Scatter plot plot(iris$Sepal.Length, iris$Petal.Length,      main = "Base R: Sepal Length vs Petal Length",      xlab = "Sepal Length",      ylab = "Petal Length",      col = as.numeric(iris$Species),      pch = 19) legend("topleft",        legend = levels(iris$Species),        col = 1:3,        pch = 19) # Histogram hist(iris$Sepal.Width,      main = "Base R: Distribution of Sepal Width",      xlab = "Sepal Width",      col = "lightblue",      border = "white") # Lattice Graphics library(lattice) # Conditional scatter plot xyplot(Petal.Length ~ Sepal.Length | Species,        data = iris,        main = "Lattice: Petal Length vs Sepal Length by Species...

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

> # Load package > library(plyr) > > # Step 1: Import the dataset > students <- read.table("Assignment 6 Dataset.txt", header = TRUE, sep = ",") > > # Mean Grade using Sex as the category > students_gendered_mean <- ddply(students, "Sex", transform, + Grade.Average = mean(Grade)) > > # View result > students_gendered_mean Name Age Sex Grade Grade.Average 1 Lauri 21 Female 90 86.9375 2 Leonie 21 Female 91 86.9375 3 Sherlyn 22 Female 85 86.9375 4 Mikaela 20 Female 69 86.9375 5 Aiko 24 Female 97 86.9375 6 Tiffaney 21 Female 78 86.9375 7 Corina 23 Female 81 86.9375 8 Petronila 23 Female 98 86.9375 9 Alecia 20 Female 87 86.9375 10 Shemika 23 Female 97 86.9375 11 Fallon 22 Female 90 86.9375 12 Deloris 21 Female 67 86.9375 13 Randee 23 Female 91 ...