The following exercises allow to verify your understanding on basic R concepts and commands:
2.5.1 The ER of R
When discussing the fit between tools and tasks in Chapter 1, we encountered the notion of ecological rationality (ER, in Section 1.2.6). Now that we have learned some basic R concepts and commands, we can ask:
Where would R be located in Figure 1.7?
Where could we place an individual R function?
How does the arrangement change when distinguishing between R (the language), RStudio (the software), or some R package?
Note: Try answering these questions in a few sentences, rather than optimizing your answers. Thinking too long about these issues can make us quite dizzy.
The following exercises can be solved by using vectors as the only R data structure:
2.5.2 Data types and forms
Please answer the following questions in a few sentences:
Describe the similarities and differences between scalars and vectors in R.
What are the main data types in R? Which function(s) allow checking or verifying them for a given data object?
Describe the difference between logical and numeric indexing (of a vector) in your own words.
2.5.3 Exploring a function
- See 1.8.2 Exercise 2
2.5.4 Cumulative savings
- See 1.8.4 Exercise 4
2.5.5 Vector arithmetic
- See 1.8.5 Exercise 5
2.5.6 Cryptic arithmetic
- See 1.8.6 Exercise 6
This concludes our exercises on basic R concepts and commands.