4.3 Lists
You are not limited to storing just one value in a variable. For example, you could put the numbers 1 to 10 into \(x\) with the following code:
<- 1:10
x x
We can be more precise to change the increment to a different number.
<- seq(from = 1, to = 10, by = 0.5)
x x
Note that the from, to, and by are not required syntax, but is included here for better understandability of the code, as shown in the example that follows.
<- seq(1, 10, 0.5)
x1 x1
We could have a vector where the numbers do not follow any logical sequence, such as:
<- c(1, 6, 9)
x x
Here the notation c() is a way to combine data into one list. This example combines numbers, but this c() function also combines text.