Skip to main content
Chemistry LibreTexts

1: R and RStudio

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \) \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)\(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\) \(\newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\) \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\) \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\) \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\) \( \newcommand{\Span}{\mathrm{span}}\)\(\newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    As we move through this textbook, we will make frequent use of the statistical programming language R, accessing the program through the RStudio Desktop interface, which provides a useful environment for managing files and for writing code. There are many programs you can use in place of R and RStudio: some, such as Python, are free, and others, such as SPSS or Matlab, are commercial packages. We will use R and RStudio for four reasons:

    1. Both R and RStudio are available at no cost.
    2. As a programming language, R is designed specifically for the analysis of data; this is one its great strength.
    3. The base installation of R comes with most of the tools we need, including tools for visualizing data.
    4. When we need additional tools, packages of functions built by other users are available to us.

    To ensure that this textbook is not tied too directly to R—and, therefore, accessible to anyone interested in learning about chemometics—each chapter begins with a general treatment of a chemometric topic that is software-independent, followed by specific examples of how to implement the topic using R.

    This page titled 1: R and RStudio is shared under a CC BY-NC-SA 4.0 license and was authored, remixed, and/or curated by David Harvey.

    • Was this article helpful?