Posts

Showing posts from November, 2025

Final Project: Build and Share Your Own R Package

GitHub Repository:  AustinTCurtis/AustinCurtis: For LIS4370 For my final project, I created an R package called co2Package , which analyzes annual CO₂ emissions by country. The package uses a real dataset from Our World in Data and includes custom functions, defensive programming, documentation, and a full vignette. This project helped me understand how professional R packages are built, tested, and documented, while also giving me hands-on experience with GitHub version control. Choosing the Dataset I selected the Annual CO2 Emissions per Country dataset from Our World in Data because: It is real-world, meaningful, and relevant to climate policy. It contains multiple variables suitable for analysis. It provides an opportunity to visualize long-term global trends. It fits naturally into a package with summary and plotting functions. After downloading the CSV file, I imported, cleaned, and standardized the variable names inside my package using a script stored in...

Module 12: Introduction to R Markdown

Image
Github Repository:  AustinTCurtis/r-programming-assignments This week, I learned how R Markdown combines plain text, code, and mathematical notation into one cohesive document. Markdown syntax makes it easy to structure reports using headings, lists, bold or italic text, and hyperlinks, while LaTeX provides a clean way to display mathematical expressions both inline (e.g., $\alpha + \beta = \gamma$) and in block form. I found that code chunks and narrative sections integrate seamlessly. Each R code block runs automatically during knitting, and the results appear directly below the explanations. This helps ensure transparency and reproducibility anyone can see both the code and its output together in context. One of the main challenges I faced was understanding the correct placement of code chunks and ensuring they were surrounded by triple backticks  ```{r}  at first, my math syntax didn’t render properly, and my code didn’t execute because I had written it outside the ch...

Module 11: Debugging and Defensive Programming in R

GitHub Repository:  AustinTCurtis/r-programming-assignments We’re working with a function designed to flag rows in a numeric matrix that are outliers in every column according to the Tukey rule.  However, the original code contains a deliberate bug, specifically in the line that uses the && operator. Original (Buggy) Code: # Helper function for Tukey's rule tukey.outlier <- function(v) {   qs  <- stats::quantile(v, c(0.25, 0.75), na.rm = TRUE)   iqr <- diff(qs)   (v < qs[1] - 1.5 * iqr) | (v > qs[2] + 1.5 * iqr) } # Original (buggy) function tukey_multiple <- function(x) {   outliers <- array(TRUE, dim = dim(x))   for (j in 1:ncol(x)) {     outliers[, j] <- outliers[, j] && tukey.outlier(x[, j])  # <-- BUG: '&&'   }   outlier.vec <- vector("logical", length = nrow(x))   for (i in 1:nrow(x)) {     outlier.vec[i] <- all(outliers[i, ])   }   r...

Module 10: Building Your Own R Package

The Curtis R package is designed to help students, researchers, and data analysts explore and visualize vehicle efficiency and emissions data from the U.S. Environmental Protection Agency’s SmartWay program. Its purpose is to simplify the process of cleaning, analyzing, and comparing fuel efficiency trends across different vehicle classes and model years. The target audience includes learners in data science and environmental analytics courses, as well as professionals interested in sustainability reporting and transportation efficiency research. By combining robust data-handling functions with clear visualization tools, Curtis allows users to generate high-quality plots and insights without needing extensive coding experience. Key Functions The creation of "Curtis" package will include several core functions designed for accessibility and analytical depth: read_smartway(path) – Imports and cleans EPA SmartWay CSV files, ensuring consistent column names and data types. plot...