Posts

Showing posts from August, 2025

R Vectors

  R Vectors In R, the most basic type of data is called a vector. A vector is simply a collection of elements, and even a single number is treated as a vector with one element.  Matrices and arrays are also just special kinds of vectors with extra structure, like rows and columns.  Vectors can store different kinds of data, but all the elements in a single vector must be of the same type, also called mode. The main types are integer for whole numbers, numeric for decimal numbers, character for text, logical for TRUE or FALSE, and complex for complex numbers.  To combine a list of items into a vector, we use the c()  function, separating the items with commas.  One important point is that R indexing starts at 1, not 0, so the first element of any vector is accessed with [1].  We can check the type of a vector using the mode()  function, and the length using the length()  function. Vectors are very important in R because almost everything ...

Installation Report

Image
  Installation Report When switching from an Android device to macOS, I had to be careful during the first-time installation of R and RStudio because the setup process is different on Mac computers. One challenge I encountered was selecting the correct R installer, as CRAN provides versions tailored for both Intel and Apple Silicon Macs. Initially, I almost chose the Intel version, but after checking my Mac's specifications, I realized that the arm64 version was needed for Apple Silicon. Additionally, macOS displayed security warnings when I first opened RStudio, which made the process a bit confusing.  Resolutions and Verification To address these issues, I downloaded the R-4.5.1-arm64.pkg installer, which is optimized for Apple Silicon hardware, and reinstalled R without further complications.  For RStudio, I navigated to System Settings → Privacy & Security and allowed it to open despite the warning. Once both R and RStudio were open, I verified their functional...