Reference no: EM133360053
Question: This assignment requires you to enter R expressions. Be sure to read each question carefully. Note that if the question specifies a variable name, you must use that variable name exactly. So if the question specifies a variable name of "sales" your answer will be (appropriately) marked incorrect if you enter "Sales" or "SALES" or "sale". This is not a limitation of the Bb answer checker, but rather is meant to get you used to R, which distinguishes between upper and lower case letters, and generally will expect you to be accurate and consistent.
1. What is an R expression that creates a variable called sales and intializes it to 750.
2. What is an R expression that tests if the variable sales is greater than 100. (Here and equivalently for the other questions, your answer should work for any variable named sales. That is, for example, for this question you should not test to see if 750 is greater than 100.)
3. What is an R expression that tests if the variable sales is greater than 100 or less than or equal to 500.
4. What is an R expression that tests if the variable sales is not equal to 100.
5. What is an R expression that outputs the square root of sales. (Your expression should work for any numeric variable named sales.
6. What is an R expression that creates a character variable called fname and initializes it to Elvis.
7. What is an R expression that outputs the number of characters in fname. (Your expression should work for any value of fname.)
8. What is an R expression that creates a vector favFruits containing your five favorite fruits, where your five favorite fruits are apples, bananas, oranges, grapes and kiwis.
9. What is an R expression that creates a vector called ages, initialized with the values 25, 32, 28, 12, 84, 57.
10. What is an R expression that creates a vector called agesPlus1 that contains the values in ages each incremented by one. Your expression of course should work for any vector called ages, not only the one you just created.
11. What is an R expression that outputs the mean of ages. Your expression should work for any numeric vector named ages, including those that have missing values.
12. What is an R expression that outputs the median of ages. Your expression should work for any numeric vector named ages, including those that have missing values.
13. What is an R expression that outputs the median of ages. Your expression should work for any numeric vector named ages, including those that have missing values.
14. What is an R expression that outputs the minimum value in ages. Your expression should work for any numeric vector named ages, including those that have missing values.
15. What is an R expression that outputs the maximum value in ages. Your expression should work for any numeric vector named ages, including those that have missing values.
16. What is an R expression that outputs only the second element of ages.
17. What is an R expression that outputs only the second, fifth and sixth elements of ages.