Exercise 1:Introduction to R
By Kristen Sosulski
Solve The Tasks In Order To Get Hands On The Concepts
Task 1 to 4:
- (123 – 45) / 4 + 4 * (72 / 2.34 – 3)
- absolute value of -88
- log10(72)
- e^1.45 – 2.612
Task 5:
a. Assign a variable year_born to 1984
b. Assign a variable year_current to 2014
c. Assign a variable age and compute it
d. Return True/False if person is eligible to vote in US (if age is greater than or equal to 18)
Task 6:
Given: formula for area of circle is pi*r^2
Given: Area = 100
a. Write statement to find r. (Hint: utilize “sqrt” and “pi” functions)
Task 7:
Given: went to lunch and pre-tax bill was $45.90
a. Compute subtotal: add NYC tax of 8.875%
b. Compute 15% tip on subtotal
c. Compute 20% tip on subtotal