Answers: Explore use of R
Explore use of R as a calculator: Part 03. Explore use of R
1. Answer: these are arithmetic operators, where “+” is addition”, “-” is subtraction, “*” is multiplication, and “/” is division.
2. Answer. All you should see is the R prompt. Unless you tell R to print to screen, the action is hidden to you, btu
stored in memory
3. Answer. firstEq
should give output [1] 8,
etc. for each named object. Sys.Date()
should return today’s date, e.g., [1] "2018-08-01"
, year – month – day
4. Time difference of 347 days
5. Time difference of 49.57143 weeks
6. Answer will vary
Explore use of logical and relational operators in R
7. Answer True
8. Answer True
9. [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Technically we could leave off “by=1” because the default increment is by one.
[1] 1 5 9 13 17
10. y, you should get [1] 1 2 3 4
; suby
, you should get [1] 16 17 18 19 20
11. For by = 1, you should get [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
For by = 4, you should get [1] 1 5 9 13 17
12. Answer. 35