More detailed answers for all of the exercises are located at http://dornsife.usc.edu/labs/rwilcox/books/ in the file answers_wiley.pdf.

**3**. `sum(x)/length(x)`

**4**. `sum(x[x>0])`

**5**. `id=which(x==max(x))`

`mean(x[-id])`

, which returns 1.25. **6**. The values are and . **7**. The average is 24.1. **9**. `sum(x)/length(x)`

returns 4.8. `x-4`

subtracts 4 from each value. **10**. `sum(x-mean(x))`

returns 1.776357e15, where e15 means . The exact value is zero. **11**. Two commands: `id=!is.na(m[,1])`

and `m[id,]`

**1**. (a) 22, (b) 2, (c) 20, (d) 484, (e) 27, (f) , (g) 2, (h) 220, (i) 12, (j) 54. **2**. (a) , (b) , (c) . **4**. (a) , , (b), . **5**. , . **6**. 338.1. **7**. (a) 30.6, (b) 120.6, ...

Start Free Trial

No credit card required