Question: Write an R script that contains R statements to address the following numbered items. Use R comments (lines starting with the # symbol) to clearly
Write an R script that contains R statements to address the following numbered items. Use R comments (lines starting with the # symbol) to clearly indicate for which numbered item the statements are intended. A template file titled COS-206_Written_Assignment_Template.R can be found in the Course Documents folder. Using the colon operator : create a vector called numbers1 that has the items 3, 4, 5, 6, & 7. Using the c function, create a vector called numbers2 that has the items 3, 9, 27, 81, & 105. Calculate the element-wise products of numbers1 and numbers2. For example, the first element-wise product is the first item of numbers1 (3) times the first item of numbers2 (3). Calculate the remainder for each of the item in numbers2 divided by 4. What is the value of num1 after executing the statement: num1=sqrt(7)^4 What is the value of num2 after executing the statement: num2=7^2 Write R code(s) to correctly compare num1 and num2 for equality Write R codes(s) to generate a logic vector (a vector contains only TRUE or FALSE) that indicates if the corresponding value in vector numbers1 created in question 1 is greater than or equal to 5. For example, the first value in numbers1 is 3, which is less than 5. Therefore its corresponding logic value is FALSE. Given a variable val, write R code(s) to check if val is infinite, is not a number, and is not available. Given a variable val2, write R code(s) to check if val2 is greater than 3 but less than or equal to 30. Write R code(s) to check if any value in vector numbers1 created in question 1 is greater than 6.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
