Skip to main content
Statistics LibreTexts

2: Introduction to R

  • Page ID
    7641
  • Learning Objectives

    Having finished this chapter, you should be able to:

    • Interact with an RMarkdown notebook in RStudio
    • Describe the difference between a variable and a function
    • Describe the different types of variables
    • Create a vector or data frame and access its elements
    • Install and load an R library
    • Load data from a file and view the data frame

    This chapter is the first of several distributed throughout the book that will introduce you to increasingly sophisticated things that you can do using the R programming language. The name “R” is a play on the names of the two authors of the software package (Ross Ihaka and Robert Gentleman) as well as an homage to an older statistical software package called “S”. R has become one of the most popular programming languages for statistical analysis and “data science”. Unlike general-purpose programming languages such as Python or Java, R is purpose-built for statistics. That doesn’t mean that you can’t do more general things with it, but the place where it really shines is in data analysis and statistics.