` [1] 27.456 35.112 8.910 20.250 38.440 NA 15.390 1.265 52.500 25.056`

`[1] 224.379`

`[1] 2.2 1.5 4.0 7.5 3.2`

`[1] 9.6 7.6 7.5`

`[1] 9.6 7.6 2.2 1.5 4.0`

`[1] 27.456 35.112 8.910`

Exercise

You have data on the length, width, and height of 10 individuals of the yew *Taxus baccata* stored in the following vectors:

```
length <- c(2.2, 2.1, 2.7, 3.0, 3.1, 2.5, 1.9, 1.1, 3.5, 2.9)
width <- c(1.3, 2.2, 1.5, 4.5, 3.1, NA, 1.8, 0.5, 2.0, 2.7)
height <- c(9.6, 7.6, 2.2, 1.5, 4.0, 3.0, 4.5, 2.3, 7.5, 3.2)
```

Copy these vectors into an R script and then determine the following:

- The volume of each shrub (length × width × height).
*Storing this in a variable will make some of the next problems easier*. - The sum of the volume of all of the shrubs (using the
`sum`

function). - A vector of the height of shrubs with lengths > 2.5.
- A vector of the height of shrubs with heights > 5.
- A vector of the heights of the first 5 shrubs (using
`[]`

). - A vector of the volumes of the first 3 shrubs (using
`[]`

).

Output solution

` [1] 27.456 35.112 8.910 20.250 38.440 NA 15.390 1.265 52.500 25.056`

`[1] 224.379`

`[1] 2.2 1.5 4.0 7.5 3.2`

`[1] 9.6 7.6 7.5`

`[1] 9.6 7.6 2.2 1.5 4.0`

`[1] 27.456 35.112 8.910`