Question: R language library(test that) library (digest) library (stringr) library (dplyr) library (tibble) library (knitr) Hint: Use dplyr to manipuate the datasets in questions 1 and

R language

R language library(test that) library (digest) library (stringr) library (dplyr) library (tibble)library (knitr) Hint: Use dplyr to manipuate the datasets in questions 1

library(test that) library (digest) library (stringr) library (dplyr) library (tibble) library (knitr) Hint: Use dplyr to manipuate the datasets in questions 1 and 2. Use seqo, lmo , coefficients, and summary() in question 3. Question 1 For the following questions, use the mtcars dataset. head (mtcars) Question 1A First, find the average mile per gallon ( mpg ) for V-shaped and straight engines ( vs ). Find the difference between these two averages (VS avg mpg - Straight avg mpg) and name this difference ans. # your code here fail() # No Answer - remove if you provide an answer ## question la - check whether variable ans was created and is length 1 test_that (desc="ans is not defined or not a list", code={ expect_equal (typeof (ans), "list") }) test_that (desc="ans is not defined or not length 1", code={ expect_equal (length (ans), 1) }) Question 1B In the dataset, there are 3 unique numbers of cylinders (cyl ). Filter based on the largest number of cylinders. Extract the names of the cars who have manual transmissions ( am == 1 ). Name this output of row names ans. # your code here fail # No Answer remove if you provide an answer ## question 1b - check whether variable ans is defined and character ouputs of length 2 test_that (desc="ans is not defined or is not a list", code={ expect_equal (typeof (ans), "character") test_that (desc="ans is not defined or is not length 1", code={ expect_equal (length(ans), 2) Question 1C Find the average mpg for cars with 8 cylinders. 8 cylinder cars with manual transmissions have what % larger average miles per gallon than automatic transmissions? Keep you answer in decimal form and name it ans . # your code here fail() # No Answer - remove if you provide an answer ## quesiton 1c - check whether variable ans is defined as a list and of length 1 test_that (desc="ans is not defined or is not a list", code={ expect_equal (typeof (ans), "list") }) test_that (desc="ans is not defined or is not length 1, code={ expect_equal (length(ans), 1) }) library(test that) library (digest) library (stringr) library (dplyr) library (tibble) library (knitr) Hint: Use dplyr to manipuate the datasets in questions 1 and 2. Use seqo, lmo , coefficients, and summary() in question 3. Question 1 For the following questions, use the mtcars dataset. head (mtcars) Question 1A First, find the average mile per gallon ( mpg ) for V-shaped and straight engines ( vs ). Find the difference between these two averages (VS avg mpg - Straight avg mpg) and name this difference ans. # your code here fail() # No Answer - remove if you provide an answer ## question la - check whether variable ans was created and is length 1 test_that (desc="ans is not defined or not a list", code={ expect_equal (typeof (ans), "list") }) test_that (desc="ans is not defined or not length 1", code={ expect_equal (length (ans), 1) }) Question 1B In the dataset, there are 3 unique numbers of cylinders (cyl ). Filter based on the largest number of cylinders. Extract the names of the cars who have manual transmissions ( am == 1 ). Name this output of row names ans. # your code here fail # No Answer remove if you provide an answer ## question 1b - check whether variable ans is defined and character ouputs of length 2 test_that (desc="ans is not defined or is not a list", code={ expect_equal (typeof (ans), "character") test_that (desc="ans is not defined or is not length 1", code={ expect_equal (length(ans), 2) Question 1C Find the average mpg for cars with 8 cylinders. 8 cylinder cars with manual transmissions have what % larger average miles per gallon than automatic transmissions? Keep you answer in decimal form and name it ans . # your code here fail() # No Answer - remove if you provide an answer ## quesiton 1c - check whether variable ans is defined as a list and of length 1 test_that (desc="ans is not defined or is not a list", code={ expect_equal (typeof (ans), "list") }) test_that (desc="ans is not defined or is not length 1, code={ expect_equal (length(ans), 1) })

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!