Answered step by step
Verified Expert Solution
Question
1 Approved Answer
do all questions please thanks ! 3. (12 pts) Jack collected data on cars, shown in the table below. a) (5pts) Create the following data
do all questions please thanks !
3. (12 pts) Jack collected data on cars, shown in the table below. a) (5pts) Create the following data frame, called Mycars. Model Color MPG Miles Honda Black 22 10000 Honda White 22 12000 Toyota White 25 15000 Ford Blue 30 20000 Ford Red 30 5000 b) (7pts) Create a for loop to do the following: loop through each row of the data frame, if a car is a Japanese car (Honda or Toyota), then add 5 to the MPG number; and if a car is a U.S. car (Ford), then subtract 5 to the MPG number. 4. (6pts) Use the InsectSprays data in R. The variable count showed the number of sprays. The variable Spray showed the type of the spray. Generate a histogram to show the distribution of the variable count with 15 bins, color the border black and fill the bars with red. 5. (12pts) Use USArrests data in R. The variable Murder recorded the murder rate at the 50 states in 1973, the variable Assault showed the assault rate in 1973, the variable Rape showed the rape rate in 1973, and the variable UrbanPop showed the percent of the population living in urban area at the 50 states. Perform the following: a) (6pts) Generate an appropriate lot to show the relationship between the two variables: Murder (y) and UrbanPop (x), and fit the plot with a linear red regression line without showing the confidence interval band. Label the x axis as Urban Population, and label the y- axis as Murder Rate. b) (6pts) Generate one appropriate graph show the five-number summary of Assault. Color the inside with red Step 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