Posts

Showing posts from January, 2026

Evaluating and Debugging an R Function

Image
Import Instructions Review For this assignment, I downloaded and reviewed the How to Import Data to RStudio document. This document serves as a data import cheat sheet and focuses on using functions from the readr package to bring data into R. Common functions discussed include read_csv() , read_tsv() , and read_delim() for importing tabular data with different delimiters. The guide also explains how R automatically guesses column data types, how to manually specify column types when needed, and how to diagnose parsing issues using the problems() function. Additionally, the document introduces tibbles as enhanced data frames and provides an overview of tidyr functions used to reshape and clean data into a tidy format. Result / Error Message When running the function, R returns the following error:   Explanation of the Error The function fails because the variable names inside the function do not match the function’s argument. Although the argument is named assignment2 , the...

Installing R and RStudio

Image
  R and RStudio were already installed on my system prior to starting this course. I have used these tools before, so I did not encounter any issues during installation for this assignment. I opened RStudio successfully and confirmed that the console was working as expected. Since both programs were previously installed, no troubleshooting was required. I verified that RStudio was correctly connected to R by checking that the console loaded properly and accepted commands without errors. I am using macOS (version Sequoia 15.6.1). My installed R version is 4.5.1 and my RStudio version is 2025.05.1+513. After confirming the versions, I was able to proceed without any problems.  Understanding R Vectors An R vector is the most basic and essential data structure in R and represents a sequence of values of the same data type, such as numeric, character, or logical values. According to Matloff, vectors are the “workhorse” of R because many higher-level structures, includin...