Answered step by step
Verified Expert Solution
Question
1 Approved Answer
R language Question 2 For the following questions, use the trees data. Read about the variables in trees , particularly what each variables is measuring
R language
Question 2 For the following questions, use the trees data. Read about the variables in trees , particularly what each variables is measuring and in what units. ?trees head (trees) Quesiton 2A Assume the trunk of each tree is approximately a cylinder. For each tree in the dataset trees , calculate the base of the trunk in square feet Name this column vector base. Hint: 12 inches = 1 foot, use base R variable pi for pi # your code here fail # No Answer - remove if you provide an answer ## question 2a - check whether base is length 31, is type double, and component 2 is correct test_that (desc="base is not defined or not length 31", code={ expect_equal (length(base), 31) }) test_that (desc="base is not defined or not type double", code={ expect_equal of (b "double") }) test_that (desc="base is not defined or not length 31", code={ expect_equal (round(base[2], 3), 0.403) }) Question 2B Using the base values calculated in Question 2A, create a boxplot. Save the boxplot as b. #your code here fail #No Answer - remove if you provide an answer ## question 26 check whether b exists and is a list of length 6 test_that (desc="b does not exist or is not a list", code={ expect_equal (typeof (b), "list") }) test_that (desc="b does not exist or is not length 6", code={ expect_equal (length(b), 6) }) Question 2C Using b and trees , pull the row vector for the outlier tree. Format the row vector as a tibble named outlier. #your code here fail # No Answer - remove if you provide an answer ## question 2c - check whether outlier exists and is of length 3 and column "Girth" exists test_that (desc="outlier does not exist or is not length 3", code={ expect_equal (length(outlier), 3) }) test_that (desc="outlier does not exist or does not have a column named Girth", code={ expect_equal (outlier $Girth > 0, TRUE) }) Question 2D Using b and trees , pull out row vector for the outlier tree. With the remaining observations, create a kable from knitr . Name the kable treesk. # your code here fail # No Answer - remove if you provide an answer ## question 2d - check whether treesk exists and is a character of length 32 test_that (desc="treesk does not exist or is not a character", code={ expect_equal (typeof (treesk), "character") }) test_that (desc="treesk does not exist or is not length 32", code={ expect_equal (length(treesk), 32) }) Question 3Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started