Question: Using R code 7. Consider the data frame Cars93 from the package MASS . (a) Find the number of columns and their names for this

Using R code

7. Consider the data frame Cars93 from the package MASS.

(a) Find the number of columns and their names for this data frame.

(b) Convert the Weight (pounds) column to a factor as Small if Weight is between

0 and 2500; Median if between 2500 and 3500; and Large if over 3500. Add

such a column with name Car.size to the data frame Cars93.

(c) Find the mean of MPG.city for those cars in Small, Median, or Large cate

gories respectively. Commend your finding

Using R code 7. Consider the data frame Cars93 from the package

33.9 > print (Car393) Manufacturer 1 Acura 2 Acura 3 Audi 4 Audi 5 BMW 6 Buick 7 Buick 8 Buick 9 Buick 10 Cadillac Model Type Min.Price Price Max.Price MPG.city Integra Small 12.9 15.9 18.8 25 Legend Midsize 29.2 38.7 18 90 Compact 25.9 29.1 32.3 20 100 Midsize 30.8 37.7 44.6 19 535i Midsize 23.7 30.0 36.2 22 Century Midsize 14.2 15.7 17.3 22 LeSabre Large 19.9 20.8 21.7 19 Roadmaster Large 22.6 23.7 24.9 16 Riviera Midsize 26.3 26.3 26.3 19 DeVille Large 33.0 34.7 36.3 16 33.9 > print (Car393) Manufacturer 1 Acura 2 Acura 3 Audi 4 Audi 5 BMW 6 Buick 7 Buick 8 Buick 9 Buick 10 Cadillac Model Type Min.Price Price Max.Price MPG.city Integra Small 12.9 15.9 18.8 25 Legend Midsize 29.2 38.7 18 90 Compact 25.9 29.1 32.3 20 100 Midsize 30.8 37.7 44.6 19 535i Midsize 23.7 30.0 36.2 22 Century Midsize 14.2 15.7 17.3 22 LeSabre Large 19.9 20.8 21.7 19 Roadmaster Large 22.6 23.7 24.9 16 Riviera Midsize 26.3 26.3 26.3 19 DeVille Large 33.0 34.7 36.3 16

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!