BG 9
.pdf
keyboard_arrow_up
School
University of British Columbia *
*We aren’t endorsed by this school
Course
COMM 205
Subject
Mathematics
Date
Jan 9, 2024
Type
Pages
4
Uploaded by BrigadierProton23752
Breakout Group (BG) 9
Due
Nov 8 at 11p.m.
Points
10
Questions
2
Available
Nov 8 at 12p.m. - Nov 8 at 11:59p.m.
11 hours and 59 minutes
Time Limit
None
Allowed Attempts
Unlimited
Instructions
This quiz was locked Nov 8 at 11:59p.m..
Attempt History
Attempt
Time
Score
LATEST
Attempt 1
11 minutes
10 out of 10
Score for this attempt:
10
out of 10
Submitted Nov 8 at 1:28p.m.
This attempt took 11 minutes.
Please submit your answers by the end of the class. Every student should submit their own answers.
Please use
this file
(https://canvas.ubc.ca/courses/123136/files/28052692?wrap=1)
(https://canvas.ubc.ca/courses/123136/files/28052692/download?download_frd=1)
for this BG exercise.
Please open up your RStudio first and then open the file in RStudio. If you click on the file directly,
your system might not recognize the file association.
5 / 5 pts
Question 1
A little bit of an overview for using Vectors in Arithmetic Operations:
An arithmetic operation between a vector and an atomic value:
Atomic value will be applied to each element of the vector
An arithmetic operation between two vectors
Operation is performed element-wise
In both cases, the result is a vector
Suppose we have a vector of cities, a vector for countries that they are
in and another vector for today's temperature (in Celsius) in those
cities. A given position in these vectors corresponds to the same city.
cities <- c("Vancouver", "Toronto", "New York",
"Los Angeles", "Dallas", "Phoenix",
"Tampa", "Winnipeg", "Saskatoon",
"Edmonton")
country <- c("Canadian","Canadian","American",
"American","American","American",
"American","Canadian","Canadian",
"Canadian")
today_temp_C <- c(10, 5, 2, 15, 25, 24, 20, -2, -5, -3)
Suppose tomorrow will be 2 degrees Celsius warmer than today.
Create a tomorrow_temp_F vector that would tell the temperature in
Fahrenheit in those cities tomorrow?
tomorrow_temp_F <- 1.8 * today_temp_C + 32 + 2
tomorrow_temp_F <- 1.8 * (today_temp_C + 2) + 32
Correct!
Correct!
tomorrow_temp_F <- 1.8(today_temp_C + 2) + 32
(tomorrow_temp_F - 32)/1.8 - 2 <- today_temp_C
5 / 5 pts
Question 2
A little bit of an overview for the implicit coercion in Arithmetic
Operations with Vectors:
If the vector's data type does not fit in the arithmetic operation, R will
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help