Posts

Showing posts from November, 2025

Module 12. Assignment

Image
This task was more challenging than I anticipated. I needed to do further study and troubleshooting before comprehending the functionality of R Markdown. I acquired foundational knowledge of Markdown formatting and the composition of basic LaTeX mathematics; nonetheless, the most arduous aspect was ensuring that each code segment was properly started and terminated. A single missed backtick resulted in problems while knitting. I also learnt how narrative text and code segments collaborate to produce a coherent, repeatable report. Despite requiring time and patience, the completion of this exercise significantly enhanced my comprehension of the R Markdown structure. R-CODE  --- title: "My R Markdown Primer" author: "Shanzay Khan" date: "`r Sys.Date()`" output: html_document --- ## Introduction R Markdown is a document format that lets you combine **narrative text**, **R code**, and **math formulas** in a single file with the `.Rmd` extension. Instead o...

Module 11 Debugging Assignment

Image
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("logical", length = nrow(x))   for (i in 1:nrow(x)) {     outlier.vec[i] <- all(outliers[i, ])   }   return(outlier.vec) } set.seed(123) test_mat <- matrix(rnorm(50), nrow = 10) tukey_multiple(test_mat) corrected_tukey <- function(x) {   outliers <- array(TRUE, dim = dim(x))   for (j in seq_len(ncol(x))) {     # FIX: use element-wise '&' instead of scalar '&&'     outliers[, j] <- outliers[, j] & tukey.outlier(x[, j])   }   outlier.vec <- logical(nrow(x))   for (i in seq_len(nrow(x))) {     outlier.vec[i] <- all(outliers[i, ])   }   outlier.vec } corrected_tukey(test_mat) https://github.com/shanzay28/r-programming-assignments/blob/...

First -R- Package

 Purpose and Scope https://github.com/shanzay28/Friedman/tree/master The Friedman package was developed for my LIS4370 R Programming course to explore how R packages are structured, documented, and shared. It is designed for students, data analysts, and beginners in R who want to understand how functions, metadata, and documentation fit together in a reusable library. This package provides simple utility functions that demonstrate clean coding, proper documentation, and reproducibility practices. Users can install it directly from GitHub and test small, practical functions for everyday data analysis tasks. Key Functions The current version (0.0.0.9000) includes four basic but well-documented functions: • hello() – Prints a friendly “Hello, world!” message confirming that the package loads correctly. • add_numbers(x, y) – Adds two numeric values and returns their sum with input validation. • calculate_mean(x, na.rm = TRUE) – Computes the mean of a numeric vector, safely handli...