Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

According to code grade, all my code are correct except for 5a, 5b, and 7a. On question 5a and 5b, code grade shows that my

According to code grade, all my code are correct except for 5a, 5b, and 7a. On question 5a and 5b, code grade shows that my code output is correct but the structure is problematic. For 7a, both the code structure and out are incorrect. I have tried everything, and I don't know what to do. This is R programing by the way. Please help! I want to know what is wrong with my code. The screenshots are from code grade, I am unable to fix what its asking of me. Questions with red X are wrong

image text in transcribedimage text in transcribedimage text in transcribed

(Q7a - Output) Did you correctly find the average rating of Chardonnay wines from % os the "Central Coast" region? (Q7b - Output) Did you correctly find the average price of wines that are either 1/1 os Chardonnays or are from the Info Input: No input. Expected output: Actual output: (Q7a - Structure) Using a single line of code, did you use the mean0 function on a logical vector and use square brackets %/125 to filter on multiple conditions using the "\&" operator? (Q7b - Structure) Using a single line of code, did you use the mean0 function on a logical vector and use square brackets 1/125 (Q5a - Structure) Using a single line of code, did you use the mean function on the points column and filter the subregion using square brackets? (Q5b - Structure) Using a single line of code, did you use the mean function on the price column and filter on the %15 subregion using square brackets? Hint: If there are NAs, they should be removed.* \#Q8 Use the read.csv() function to read in the Wine.csv file. Don't forget to use the strings=T argument. (wine$ price, na. rm=T ) \# Q5a Use the mean function to calculate the average points for the Napa Sonoma sub-region. Your code should be a single line and will use the square brackets mean (wine\$points [wine\$sub== "Napa-Sonoma"], na.rm=T) \# Q5b Use the mean function to calculate the average price for the Napa Sonoma sub-region, again in a single line of code. mean (wine\$price[wine\$sub== "Napa-Sonoma" ], na.rm=T) \# Q6 Now we'll practice our counting skills again. \# The rating scale being used by these tasters orignally had 91 as the highest possible score and now goes to 100 for exceedingly delicious wines. \# Use the sum() function on a logical vector that checks for whether points are greater than 91 or not to count the number of wine ratings with more than 91 poi sum(wine\$points>91) \# Q7a Now we'll practice subsetting on more than one criteria. \# Use the mean function to compute the average points for wines that are chardonnay wines and from the central coast sub-region. mean (wine\$points [wine $ variety=="Chardonnay" \& wine $ sub=="Central Coast"], na.rm=T) \# Q7b More practice subsetting on more than one criteria. \# Use the mean function to compute the average price for wines that are either chardonnay wines or are from the finger lakes sub-region. mean (wine\$price[wine\$variety=="Chardonnay" | wine $ sub== "Finger Lakes"], na.rm=T) \# Q8 Use the median function to find the median price for a Cabernet Sauvignon that is rated higher than 91 points. median (wine\$price[wine\$variety=="Cabernet Sauvignon"\& wine\$points >91], na.rm=T)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions