## 2.5 Conclusion

### 2.5.1 Summary

This chapter provided a brief introduction to R .

Conceptually, we introduced and distinguished between

• different R objects (e.g., data vs. functions),
• different types of data (e.g., Boolean values of type logical, numeric objects of type double or integer, and text objects of type character), and
• different shapes of data (e.g., scalars vs. longer vectors).

In Section 2.2, we distinguished data objects from functions and showed how to create and change scalar objects in R (by assignment). In Section 2.3, we introduced the notion of atomic vectors and learned how to create vectors of various lengths (by using vector creation functions and logical or numeric indexing). Finally, Section 2.4 introduced the elements of functions (e.g., required vs. optional arguments) and showed how functions can be explored.

A key limitation of this chapter was that we used linear vectors as the only data structure. In Chapter 3 on Data structures, we will encounter atomic vectors in more complex shapes (e.g., as matrices) and learn to combine them into more complex data structures (e.g., data frames or lists).

### 2.5.2 Resources

There is no shortage of introductory books and scripts on R, but it is helpful to look for one that fits your interests and level of expertise.

#### Books and online scripts

• For a collection of materials and scripts, see R manuals and other documentation.

• Bookdown.org and its archive page contain books on a wide array of topics. Easy recommendations include:

• YaRrr! The Pirate’s Guide to R is an introduction that approaches R in a funny and entertaining fashion. (See Rpository.com/learnR/ for a course with corresponding exercises and solutions.)

• Hands-On Programming with R provides a solid introduction to R.

• Advanced R (2nd edition) is an valuable source for R users who want to deepen their programming skills and understanding of the language. The following chapters cover topics relevant to basic R concepts and commands in much more detail:

• 2: Names and values clarifies assignments and object references
• 3: Vectors explains data types and shapes (including data frames and tibbles)
• 4: Subsetting shows many ways of accessing and changing data stored in R objects
- For advanced users, Hadley Wickham's books [Advanced R](http://adv-r.had.co.nz/) [@Wickham2014advanced; @Wickham2019advanced] and [R Packages](http://r-pkgs.had.co.nz/) [@Wickham2015] are indispensable resources  

#### Cheatsheets

Here are some pointers to related RStudio cheatsheets:

• Base R:

#### Miscellaneous

Other helpful links that do not fit into the above categories include:

• R-bloggers collects blog posts on R.

• Quick-R (by Robert Kabacoff) is a popular website on R programming.

• R-exercises provides categorized sets of exercises to help people developing their R programming skills.

• A series of software reviews by Bob Muenchen at r4stats describes and evaluates alternative user environments for interacting with R.

### 2.5.3 Preview

In Chapter 3 on Data structures, we will encounter R data structures beyond linear vectors. More specifically, we will learn that atomic vectors can assume different shapes (e.g., as matrices) and can be combined into more complex data structures (e.g., lists and rectangular tables).

### References

Grolemund, G. (2014). Hands-on programming with R: Write your own functions and simulations. O’Reilly Media. https://rstudio-education.github.io/hopr/
Phillips, N. D. (2018). YaRrr! The pirate’s guide to R. https://bookdown.org/ndphillips/YaRrr/
R Core Team. (2021). R base: A language and environment for statistical computing. R Foundation for Statistical Computing. https://www.R-project.org