Expanding R statements
Exercise Type: Paraphrasing
Instructions
Rewrite the expressions to multiple statements, so every expression will have exactly one assignment and one other calculation!
Example
Exercise
ex <- 6^(2-4)+7
Solution
r1 <- 2-4
r2 <- 6^r1
ex <- r2 + 7
Note
This boring exercise should help with working through the basic order operations (from maths) .
A.
a <- (87-12)*45 + 32/(12 %% 5) * 84
B.
b <- (76 * 3) * 4^(1+4 * 2)
C.
c <- (78 * 43) +1 + (56 - 2)^-1 *4 * 3-1
D.
d <- 12 + ((4 * 4) + 1)^2 / 3
E.
e <- ( 13 + 1 )^2^(5 + 1) * 4
F.
f <- (12 ^ 2 + 4) * ( (3*4^3) %% 7 )