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 coerce its data type similar to atomic values in the context of arithmetic operations. The order logical --> integer --> double. Assume again that today's temperatures for the cities are given. However, suppose weather forecasts just changed. You were told that tomorrow's temperature in Canadian cities will be 2 degrees Celsius cooler than today. However, temperature in American cities will be 1 degree Celsius warmer than today. Note that we are only provided with either American or Canadian cities. What would be the tomorrow's temperature in Celsius in these cities? Complete the code below: today_temp_C - 2*(country [ Select ] = == != ! = "Canadian") + 1*(country [ Select ] = == != ! = "Canadian") You can only use logical comparison operators or arithmetic operators in each blank above. Assume that the formula above is correctly completed. Answer the following two questions regarding the data type of the segment of the the completed formula? What is the data type of the outcome of the expression in the second parenthesis when the blank there is correctly filled; That is (country XXX "Canadian") ? [ Select ] logical integer double character What is the data type of the outcome of the expression in the second term of the entire line of code when the blank there is correctly filled; That is 2*(country XXX "Canadian") ? [ Select ] logical integer double character Last two blanks are intended to show you how implicit coercion has taken place.多重下拉选择题
登录即可查看完整答案
我们收录了全球超50000道真实原题与详细解析,现在登录,立即获得答案。
类似问题
What will 3 + "2" return?
What result is returned if you execute the following code? TRUE + (!FALSE) + 1L + 1
typeof(TRUE + 5L) != typeof(TRUE + 5) This will return [Fill in the blank] as an output.
Again, suppose we have a vector name containing names of 50 students. grade is another numeric vector containing final marks of those students. We run the following code: dat <- tibble(name, grade) dat$grade[2] <- as.character(dat$grade[2]) is.numeric(dat$grade) The output should be
更多留学生实用工具
希望你的学习变得更简单
加入我们,立即解锁 海量真题 与 独家解析,让复习快人一步!