## 6.6 Test your R Might!

Create a vector that shows the square root of the integers from 1 to 10.

Renata thinks that she finds more treasure when she’s had a mug of grogg than when she doesn’t. To test this, she recorded how much treasure she found over 7 days without drinking any grogg (ie., sober), and then did the same over 7 days while drinking grogg (ie., drunk). Here are her results:

day | sober | drunk |
---|---|---|

Monday | 2 | 0 |

Tuesday | 0 | 0 |

Wednesday | 3 | 1 |

Thursday | 1 | 0 |

Friday | 0 | 1 |

Saturday | 3 | 2 |

Sunday | 5 | 2 |

How much treasure did Renata find on average when she was sober? What about when she was drunk?

Using Renata’s data again, create a new vector called

`difference`

that shows how much more treasure Renata found when she was drunk and when she was not. What was the mean, median, and standard deviation of the difference?There’s an old parable that goes something like this. A man does some work for a king and needs to be paid. Because the man loves rice (who doesn’t?!), the man offers the king two different ways that he can be paid.

*You can either pay me 100 kilograms of rice, or, you can pay me as follows: get a chessboard and put one grain of rice in the top left square. Then put 2 grains of rice on the next square, followed by 4 grains on the next, 8 grains on the next…and so on, where the amount of rice doubles on each square, until you get to the last square. When you are finished, give me all the grains of rice that would (in theory), fit on the chessboard.*The king, sensing that the man was an idiot for making such a stupid offer, immediately accepts the second option. He summons a chessboard, and begins counting out grains of rice one by one… Assuming that there are 64 squares on a chessboard, calculate how many grains of rice the main will receive. If one grain of rice weights 1/6400 kilograms, how many kilograms of rice did he get?*Hint: If you have trouble coming up with the answer, imagine how many grains are on the first, second, third and fourth squares, then try to create the vector that shows the number of grains on each square. Once you come up with that vector, you can easily calculate the final answer with the*`sum()`

function.