##Answer 6 of the next 7 points

Use the file “cars.xlsx” and load the library “dplyr”

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(openxlsx)

Point 1

Load the file “cars.xlsx” into a variable named “my_data” and check the structure using str() and glimpse()

my_data <- read.xlsx("cars.xlsx")

Como puedes ver, la base de datos cuenta con 428 observaciones y 15 variables. Las variables incluidas son: - Make = La marca del fabricante del automóvil - Model = El modelo del automóvil - Type = El tipo de automóvil - Origin = En dónde fue fabricado - DriveTrain = Indica el tipo de transmición - MSRP = Es el precio de venta en dólares sugerido por el fabricate - Invoice = Es el valor de la factura del automóvil - EngineSize = Es el tamaño del motor - Cylinders = Indica con cuántos cilindros cuenta - Horsepower = La potencia del automóvil en caballos de fuerza - MPG_City = Millas por galón de combustible en la ciudad - MPG_Highway = Millas por galón de combustible en carretera - Weight = Peso del automóvil en libras - Wheelbase = La distancia que hay entre el eje delantero y el eje trasero en pulgadas - Length = La longitud del automóvil en pulgadas

Point 2

Look for missing values (just numerical values) and replace them with the number 11.4 .

my_data2 <- my_data %>%
  mutate_all(~ ifelse(is.na(.), 11.4, .))

Point 3

Answer using “my_data” Which brand produces more vehicles and which one produces less?

# the brand that produced the most was Toyota and the least was Hummer

point3.1 <- my_data %>%
  group_by(Make) %>%
  summarise(Count = n()) %>%
  arrange(desc(Count))

How many vehicles are produce by region with “transmision delantera” how many with “transmision trasera” and how many with both(All)?

# All 92
# Front 226
# Rear 110

point3.2 <- my_data %>%
  filter(DriveTrain %in% 
           c("Front", "Rear", "All")) %>%
  group_by(DriveTrain) %>%
  summarise(Count = n())

Pregunta 4

Find the highest and the lowest MPG for both the city and the Highway. Use the commands table() and summarise() to the show the info

MPGs <- my_data2 %>%
  summarise(
    Max_MPG_City = max(MPG_City),
    Min_MPG_City = min(MPG_City),
    Max_MPG_Highway = max(MPG_Highway),
    Min_MPG_Highway = min(MPG_Highway)
  )
MPGs2 <- my_data2 %>%
  select(MPG_City, MPG_Highway)%>%
  arrange(desc(MPG_City))

Pregunta 5

Select Make, Model, Type, Origin, DriveTrain, MSRP y Length. Keep the data with DriveTrain equal to Front and save everything in a variable called “my_new_data”. Print “my_new_data”

my_new_data <- my_data2 %>%
  select(Make, Model, Type, Origin, DriveTrain, MSRP, Length) %>%
  filter(DriveTrain == "Front")
print(my_new_data)
##           Make                                   Model   Type Origin DriveTrain
## 1        Acura                          RSX Type S 2dr  Sedan   Asia      Front
## 2        Acura                                 TSX 4dr  Sedan   Asia      Front
## 3        Acura                                  TL 4dr  Sedan   Asia      Front
## 4        Acura                              3.5 RL 4dr  Sedan   Asia      Front
## 5        Acura                 3.5 RL w/Navigation 4dr  Sedan   Asia      Front
## 6         Audi                             A4 1.8T 4dr  Sedan Europe      Front
## 7         Audi                  A41.8T convertible 2dr  Sedan Europe      Front
## 8         Audi                              A4 3.0 4dr  Sedan Europe      Front
## 9         Audi                              A6 3.0 4dr  Sedan Europe      Front
## 10        Audi                  A4 3.0 convertible 2dr  Sedan Europe      Front
## 11        Audi                                RS 6 4dr Sports Europe      Front
## 12        Audi          TT 1.8 convertible 2dr (coupe) Sports Europe      Front
## 13       Buick                           Rendezvous CX    SUV    USA      Front
## 14       Buick                      Century Custom 4dr  Sedan    USA      Front
## 15       Buick                      LeSabre Custom 4dr  Sedan    USA      Front
## 16       Buick                            Regal LS 4dr  Sedan    USA      Front
## 17       Buick                            Regal GS 4dr  Sedan    USA      Front
## 18       Buick                     LeSabre Limited 4dr  Sedan    USA      Front
## 19       Buick                         Park Avenue 4dr  Sedan    USA      Front
## 20       Buick                   Park Avenue Ultra 4dr  Sedan    USA      Front
## 21    Cadillac                                Escalade    SUV    USA      Front
## 22    Cadillac                                  SRX V8    SUV    USA      Front
## 23    Cadillac                             Deville 4dr  Sedan    USA      Front
## 24    Cadillac                         Deville DTS 4dr  Sedan    USA      Front
## 25    Cadillac                         Seville SLS 4dr  Sedan    USA      Front
## 26   Chevrolet                        Suburban 1500 LT    SUV    USA      Front
## 27   Chevrolet                          TrailBlazer LT    SUV    USA      Front
## 28   Chevrolet                                 Tracker    SUV    USA      Front
## 29   Chevrolet                                Aveo 4dr  Sedan    USA      Front
## 30   Chevrolet                       Aveo LS 4dr hatch  Sedan    USA      Front
## 31   Chevrolet                            Cavalier 2dr  Sedan    USA      Front
## 32   Chevrolet                            Cavalier 4dr  Sedan    USA      Front
## 33   Chevrolet                         Cavalier LS 2dr  Sedan    USA      Front
## 34   Chevrolet                              Impala 4dr  Sedan    USA      Front
## 35   Chevrolet                              Malibu 4dr  Sedan    USA      Front
## 36   Chevrolet                           Malibu LS 4dr  Sedan    USA      Front
## 37   Chevrolet                      Monte Carlo LS 2dr  Sedan    USA      Front
## 38   Chevrolet                           Impala LS 4dr  Sedan    USA      Front
## 39   Chevrolet                           Impala SS 4dr  Sedan    USA      Front
## 40   Chevrolet                           Malibu LT 4dr  Sedan    USA      Front
## 41   Chevrolet                      Monte Carlo SS 2dr  Sedan    USA      Front
## 42   Chevrolet                              Venture LS  Sedan    USA      Front
## 43   Chevrolet                          Malibu Maxx LS  Wagon    USA      Front
## 44    Chrysler                          PT Cruiser 4dr  Sedan    USA      Front
## 45    Chrysler                  PT Cruiser Limited 4dr  Sedan    USA      Front
## 46    Chrysler                             Sebring 4dr  Sedan    USA      Front
## 47    Chrysler                     Sebring Touring 4dr  Sedan    USA      Front
## 48    Chrysler                                300M 4dr  Sedan    USA      Front
## 49    Chrysler                         Concorde LX 4dr  Sedan    USA      Front
## 50    Chrysler                        Concorde LXi 4dr  Sedan    USA      Front
## 51    Chrysler                       PT Cruiser GT 4dr  Sedan    USA      Front
## 52    Chrysler                 Sebring convertible 2dr  Sedan    USA      Front
## 53    Chrysler                300M Special Edition 4dr  Sedan    USA      Front
## 54    Chrysler         Sebring Limited convertible 2dr  Sedan    USA      Front
## 55    Chrysler                     Town and Country LX  Sedan    USA      Front
## 56    Chrysler                Town and Country Limited  Sedan    USA      Front
## 57       Dodge                             Neon SE 4dr  Sedan    USA      Front
## 58       Dodge                            Neon SXT 4dr  Sedan    USA      Front
## 59       Dodge                         Intrepid SE 4dr  Sedan    USA      Front
## 60       Dodge                         Stratus SXT 4dr  Sedan    USA      Front
## 61       Dodge                          Stratus SE 4dr  Sedan    USA      Front
## 62       Dodge                         Intrepid ES 4dr  Sedan    USA      Front
## 63       Dodge                              Caravan SE  Sedan    USA      Front
## 64        Ford                      Expedition 4.6 XLT    SUV    USA      Front
## 65        Ford                     Focus ZX3 2dr hatch  Sedan    USA      Front
## 66        Ford                            Focus LX 4dr  Sedan    USA      Front
## 67        Ford                            Focus SE 4dr  Sedan    USA      Front
## 68        Ford                           Focus ZX5 5dr  Sedan    USA      Front
## 69        Ford                           Focus SVT 2dr  Sedan    USA      Front
## 70        Ford                           Taurus LX 4dr  Sedan    USA      Front
## 71        Ford                  Taurus SES Duratec 4dr  Sedan    USA      Front
## 72        Ford                             Freestar SE  Sedan    USA      Front
## 73        Ford Thunderbird Deluxe convert w/hardtop 2d Sports    USA      Front
## 74        Ford                               Focus ZTW  Wagon    USA      Front
## 75        Ford                               Taurus SE  Wagon    USA      Front
## 76         GMC                           Envoy XUV SLE    SUV    USA      Front
## 77         GMC                          Yukon 1500 SLE    SUV    USA      Front
## 78       Honda  Civic Hybrid 4dr manual (gas/electric) Hybrid   Asia      Front
## 79       Honda              Insight 2dr (gas/electric) Hybrid   Asia      Front
## 80       Honda                            Civic DX 2dr  Sedan   Asia      Front
## 81       Honda                            Civic HX 2dr  Sedan   Asia      Front
## 82       Honda                            Civic LX 4dr  Sedan   Asia      Front
## 83       Honda                           Accord LX 2dr  Sedan   Asia      Front
## 84       Honda                           Accord EX 2dr  Sedan   Asia      Front
## 85       Honda                            Civic EX 4dr  Sedan   Asia      Front
## 86       Honda                      Civic Si 2dr hatch  Sedan   Asia      Front
## 87       Honda                        Accord LX V6 4dr  Sedan   Asia      Front
## 88       Honda                        Accord EX V6 2dr  Sedan   Asia      Front
## 89       Honda                              Odyssey LX  Sedan   Asia      Front
## 90       Honda                              Odyssey EX  Sedan   Asia      Front
## 91     Hyundai                            Santa Fe GLS    SUV   Asia      Front
## 92     Hyundai                        Accent 2dr hatch  Sedan   Asia      Front
## 93     Hyundai                           Accent GL 4dr  Sedan   Asia      Front
## 94     Hyundai                     Accent GT 2dr hatch  Sedan   Asia      Front
## 95     Hyundai                         Elantra GLS 4dr  Sedan   Asia      Front
## 96     Hyundai                          Elantra GT 4dr  Sedan   Asia      Front
## 97     Hyundai                    Elantra GT 4dr hatch  Sedan   Asia      Front
## 98     Hyundai                          Sonata GLS 4dr  Sedan   Asia      Front
## 99     Hyundai                           Sonata LX 4dr  Sedan   Asia      Front
## 100    Hyundai                               XG350 4dr  Sedan   Asia      Front
## 101    Hyundai                             XG350 L 4dr  Sedan   Asia      Front
## 102    Hyundai                       Tiburon GT V6 2dr Sports   Asia      Front
## 103   Infiniti                                 I35 4dr  Sedan   Asia      Front
## 104      Isuzu                                 Rodeo S    SUV   Asia      Front
## 105       Jeep                   Grand Cherokee Laredo    SUV    USA      Front
## 106        Kia                              Sorento LX    SUV   Asia      Front
## 107        Kia                           Optima LX 4dr  Sedan   Asia      Front
## 108        Kia                          Rio 4dr manual  Sedan   Asia      Front
## 109        Kia                            Rio 4dr auto  Sedan   Asia      Front
## 110        Kia                             Spectra 4dr  Sedan   Asia      Front
## 111        Kia                    Spectra GS 4dr hatch  Sedan   Asia      Front
## 112        Kia                   Spectra GSX 4dr hatch  Sedan   Asia      Front
## 113        Kia                        Optima LX V6 4dr  Sedan   Asia      Front
## 114        Kia                              Amanti 4dr  Sedan   Asia      Front
## 115        Kia                               Sedona LX  Sedan   Asia      Front
## 116        Kia                               Rio Cinco  Wagon   Asia      Front
## 117      Lexus                              ES 330 4dr  Sedan   Asia      Front
## 118    Lincoln                        Aviator Ultimate    SUV    USA      Front
## 119       MINI                                  Cooper  Sedan Europe      Front
## 120       MINI                                Cooper S  Sedan Europe      Front
## 121      Mazda                            Mazda3 i 4dr  Sedan   Asia      Front
## 122      Mazda                            Mazda3 s 4dr  Sedan   Asia      Front
## 123      Mazda                            Mazda6 i 4dr  Sedan   Asia      Front
## 124      Mazda                                  MPV ES  Sedan   Asia      Front
## 125    Mercury                             Mountaineer    SUV    USA      Front
## 126    Mercury                            Sable GS 4dr  Sedan    USA      Front
## 127    Mercury                    Sable LS Premium 4dr  Sedan    USA      Front
## 128    Mercury                         Monterey Luxury  Sedan    USA      Front
## 129    Mercury                                Sable GS  Wagon    USA      Front
## 130 Mitsubishi                            Outlander LS    SUV   Asia      Front
## 131 Mitsubishi                           Lancer ES 4dr  Sedan   Asia      Front
## 132 Mitsubishi                           Lancer LS 4dr  Sedan   Asia      Front
## 133 Mitsubishi                      Galant ES 2.4L 4dr  Sedan   Asia      Front
## 134 Mitsubishi                Lancer OZ Rally 4dr auto  Sedan   Asia      Front
## 135 Mitsubishi                         Diamante LS 4dr  Sedan   Asia      Front
## 136 Mitsubishi                          Galant GTS 4dr  Sedan   Asia      Front
## 137 Mitsubishi                         Eclipse GTS 2dr Sports   Asia      Front
## 138 Mitsubishi       Eclipse Spyder GT convertible 2dr Sports   Asia      Front
## 139 Mitsubishi                    Lancer Evolution 4dr Sports   Asia      Front
## 140 Mitsubishi                     Lancer Sportback LS  Wagon   Asia      Front
## 141     Nissan                    Pathfinder Armada SE    SUV   Asia      Front
## 142     Nissan                           Pathfinder SE    SUV   Asia      Front
## 143     Nissan                            Xterra XE V6    SUV   Asia      Front
## 144     Nissan                          Sentra 1.8 4dr  Sedan   Asia      Front
## 145     Nissan                        Sentra 1.8 S 4dr  Sedan   Asia      Front
## 146     Nissan                            Altima S 4dr  Sedan   Asia      Front
## 147     Nissan                         Sentra SE-R 4dr  Sedan   Asia      Front
## 148     Nissan                           Altima SE 4dr  Sedan   Asia      Front
## 149     Nissan                           Maxima SE 4dr  Sedan   Asia      Front
## 150     Nissan                           Maxima SL 4dr  Sedan   Asia      Front
## 151     Nissan                                 Quest S  Sedan   Asia      Front
## 152     Nissan                                Quest SE  Sedan   Asia      Front
## 153 Oldsmobile                            Alero GX 2dr  Sedan    USA      Front
## 154 Oldsmobile                           Alero GLS 2dr  Sedan    USA      Front
## 155 Oldsmobile                           Silhouette GL  Sedan    USA      Front
## 156    Pontiac                                  Aztekt    SUV    USA      Front
## 157    Pontiac                         Sunfire 1SA 2dr  Sedan    USA      Front
## 158    Pontiac                         Grand Am GT 2dr  Sedan    USA      Front
## 159    Pontiac                      Grand Prix GT1 4dr  Sedan    USA      Front
## 160    Pontiac                         Sunfire 1SC 2dr  Sedan    USA      Front
## 161    Pontiac                      Grand Prix GT2 4dr  Sedan    USA      Front
## 162    Pontiac                      Bonneville GXP 4dr  Sedan    USA      Front
## 163    Pontiac                                 Montana  Sedan    USA      Front
## 164       Saab                       9-3 Arc Sport 4dr  Sedan Europe      Front
## 165       Saab                            9-3 Aero 4dr  Sedan Europe      Front
## 166       Saab                             9-5 Arc 4dr  Sedan Europe      Front
## 167       Saab                            9-5 Aero 4dr  Sedan Europe      Front
## 168       Saab                 9-3 Arc convertible 2dr  Sedan Europe      Front
## 169       Saab                9-3 Aero convertible 2dr  Sedan Europe      Front
## 170       Saab                                9-5 Aero  Wagon Europe      Front
## 171     Saturn                                Ion1 4dr  Sedan    USA      Front
## 172     Saturn                                lon2 4dr  Sedan    USA      Front
## 173     Saturn                                lon3 4dr  Sedan    USA      Front
## 174     Saturn                     lon2 quad coupe 2dr  Sedan    USA      Front
## 175     Saturn                     lon3 quad coupe 2dr  Sedan    USA      Front
## 176     Saturn                              L300-2 4dr  Sedan    USA      Front
## 177     Saturn                                  L300 2  Wagon    USA      Front
## 178      Scion                            xA 4dr hatch  Sedan   Asia      Front
## 179      Scion                                      xB  Wagon   Asia      Front
## 180     Suzuki                                 XL-7 EX    SUV   Asia      Front
## 181     Suzuki                              Aeno S 4dr  Sedan   Asia      Front
## 182     Suzuki                            Aerio LX 4dr  Sedan   Asia      Front
## 183     Suzuki                           Forenza S 4dr  Sedan   Asia      Front
## 184     Suzuki                          Forenza EX 4dr  Sedan   Asia      Front
## 185     Suzuki                           Verona LX 4dr  Sedan   Asia      Front
## 186     Toyota                Prius 4dr (gas/electric) Hybrid   Asia      Front
## 187     Toyota                          4Runner SR5 V6    SUV   Asia      Front
## 188     Toyota                          Corolla CE 4dr  Sedan   Asia      Front
## 189     Toyota                           Corolla S 4dr  Sedan   Asia      Front
## 190     Toyota                          Corolla LE 4dr  Sedan   Asia      Front
## 191     Toyota                         Echo 2dr manual  Sedan   Asia      Front
## 192     Toyota                           Echo 2dr auto  Sedan   Asia      Front
## 193     Toyota                                Echo 4dr  Sedan   Asia      Front
## 194     Toyota                            Camry LE 4dr  Sedan   Asia      Front
## 195     Toyota                         Camry LE V6 4dr  Sedan   Asia      Front
## 196     Toyota                     Camry Solara SE 2dr  Sedan   Asia      Front
## 197     Toyota                  Camry Solara SE V6 2dr  Sedan   Asia      Front
## 198     Toyota                           Avalon XL 4dr  Sedan   Asia      Front
## 199     Toyota                        Camry XLE V6 4dr  Sedan   Asia      Front
## 200     Toyota                 Camry Solara SLE V6 2dr  Sedan   Asia      Front
## 201     Toyota                          Avalon XLS 4dr  Sedan   Asia      Front
## 202     Toyota                               Sienna CE  Sedan   Asia      Front
## 203     Toyota                      Sienna XLE Limited  Sedan   Asia      Front
## 204     Toyota                         Celica GT-S 2dr Sports   Asia      Front
## 205     Toyota                               Matrix XR  Wagon   Asia      Front
## 206 Volkswagen                            Golf GLS 4dr  Sedan Europe      Front
## 207 Volkswagen                      GTI 1.8T 2dr hatch  Sedan Europe      Front
## 208 Volkswagen                       Jetta GLS TDI 4dr  Sedan Europe      Front
## 209 Volkswagen                 New Beetle GLS 1.8T 2dr  Sedan Europe      Front
## 210 Volkswagen                       Jetta GLI VR6 4dr  Sedan Europe      Front
## 211 Volkswagen          New Beetle GLS convertible 2dr  Sedan Europe      Front
## 212 Volkswagen                          Passat GLS 4dr  Sedan Europe      Front
## 213 Volkswagen               Passat GLX V6 4MOTION 4dr  Sedan Europe      Front
## 214 Volkswagen                   Passat W8 4MOTION 4dr  Sedan Europe      Front
## 215 Volkswagen                             Phaeton 4dr  Sedan Europe      Front
## 216 Volkswagen                         Phaeton W12 4dr  Sedan Europe      Front
## 217 Volkswagen                                Jetta GL  Wagon Europe      Front
## 218 Volkswagen                         Passat GLS 1.8T  Wagon Europe      Front
## 219 Volkswagen                               Passat W8  Wagon Europe      Front
## 220      Volvo                                 S40 4dr  Sedan Europe      Front
## 221      Volvo                              S60 T5 4dr  Sedan Europe      Front
## 222      Volvo                             S80 2.9 4dr  Sedan Europe      Front
## 223      Volvo                 C70 LPT convertible 2dr  Sedan Europe      Front
## 224      Volvo                 C70 HPT convertible 2dr  Sedan Europe      Front
## 225      Volvo                              S80 T6 4dr  Sedan Europe      Front
## 226      Volvo                                     V40  Wagon Europe      Front
##      MSRP Length
## 1   23820  172.0
## 2   26990  183.0
## 3   33195  186.0
## 4   43755  197.0
## 5   46100  197.0
## 6   25940  179.0
## 7   35940  180.0
## 8   31840  179.0
## 9   36640  192.0
## 10  42490  180.0
## 11  84600  191.0
## 12  35940  159.0
## 13  26545  187.0
## 14  22180  195.0
## 15  26470  200.0
## 16  24895  196.0
## 17  28345  196.0
## 18  32245  200.0
## 19  35545  207.0
## 20  40720  207.0
## 21  52795  199.0
## 22  46995  195.0
## 23  45445  207.0
## 24  50595  207.0
## 25  47955  201.0
## 26  42735  219.0
## 27  30295  192.0
## 28  20255  163.0
## 29  11690  167.0
## 30  12585  153.0
## 31  14610  183.0
## 32  14810  183.0
## 33  16385  183.0
## 34  21900  200.0
## 35  18995  188.0
## 36  20370  188.0
## 37  21825  198.0
## 38  25000  200.0
## 39  27995  200.0
## 40  23495  188.0
## 41  24225  198.0
## 42  27020  187.0
## 43  22225  188.0
## 44  17985  169.0
## 45  22000  169.0
## 46  19090  191.0
## 47  21840  191.0
## 48  29865  198.0
## 49  24130  208.0
## 50  26860  208.0
## 51  25955  169.0
## 52  25215  194.0
## 53  33295  198.0
## 54  30950  194.0
## 55  27490  201.0
## 56  38380  201.0
## 57  13670  174.0
## 58  15040  174.0
## 59  22035  204.0
## 60  18820  191.0
## 61  20220  191.0
## 62  24885  204.0
## 63  21795  189.0
## 64  34560  206.0
## 65  13270  168.0
## 66  13730  168.0
## 67  15460  168.0
## 68  15580  168.0
## 69  19135  168.0
## 70  20320  198.0
## 71  22735  198.0
## 72  26930  201.0
## 73  37530  186.0
## 74  17475  178.0
## 75  22290  198.0
## 76  31890  208.0
## 77  35725  199.0
## 78  20140  175.0
## 79  19110  155.0
## 80  13270  175.0
## 81  14170  175.0
## 82  15850  175.0
## 83  19860  188.0
## 84  22260  188.0
## 85  17750  175.0
## 86  19490  166.0
## 87  23760  190.0
## 88  26960  188.0
## 89  24950  201.0
## 90  27450  201.0
## 91  21589  177.0
## 92  10539  167.0
## 93  11839  167.0
## 94  11939  167.0
## 95  13839  178.0
## 96  15389  178.0
## 97  15389  178.0
## 98  19339  187.0
## 99  20339  187.0
## 100 24589  192.0
## 101 26189  192.0
## 102 18739  173.0
## 103 31145  194.0
## 104 20449  178.0
## 105 27905  181.0
## 106 19635  180.0
## 107 16040  186.0
## 108 10280  167.0
## 109 11155  167.0
## 110 12360  178.0
## 111 13580  178.0
## 112 14630  178.0
## 113 18435  186.0
## 114 26000  196.0
## 115 20615  194.0
## 116 11905  167.0
## 117 32350  191.0
## 118 42915  193.0
## 119 16999  143.0
## 120 19999  144.0
## 121 15500  178.0
## 122 17200  179.0
## 123 19270  187.0
## 124 28750  188.0
## 125 29995  190.0
## 126 21595  200.0
## 127 23895  200.0
## 128 33995  202.0
## 129 22595  198.0
## 130 18892  179.0
## 131 14622  181.0
## 132 16722  181.0
## 133 19312  191.0
## 134 17232  181.0
## 135 29282  194.0
## 136 25700  191.0
## 137 25092  177.0
## 138 26992  177.0
## 139 29562  179.0
## 140 17495  181.0
## 141 33840  207.0
## 142 27339  183.0
## 143 20939  178.0
## 144 12740  178.0
## 145 14740  178.0
## 146 19240  192.0
## 147 17640  178.0
## 148 23290  192.0
## 149 27490  194.0
## 150 29440  194.0
## 151 24780  204.0
## 152 32780  204.0
## 153 18825  187.0
## 154 23675  187.0
## 155 28790  201.0
## 156 21595  182.0
## 157 15495  182.0
## 158 22450  186.0
## 159 22395  198.0
## 160 17735  182.0
## 161 24295  198.0
## 162 35995  203.0
## 163 23845  187.0
## 164 30860  183.0
## 165 33360  183.0
## 166 35105  190.0
## 167 39465  190.0
## 168 40670  182.0
## 169 43175  182.0
## 170 40845  190.0
## 171 10995  185.0
## 172 14300  185.0
## 173 15825  185.0
## 174 14850  185.0
## 175 16350  185.0
## 176 21410  190.0
## 177 23560  190.0
## 178 12965  154.0
## 179 14165  155.0
## 180 23699  187.0
## 181 12884  171.0
## 182 14500  171.0
## 183 12269  177.0
## 184 15568  177.0
## 185 17262  188.0
## 186 20510  175.0
## 187 27710  189.0
## 188 14085  178.0
## 189 15030  178.0
## 190 15295  178.0
## 191 10760  163.0
## 192 11560  163.0
## 193 11290  163.0
## 194 19560  189.0
## 195 22775  189.0
## 196 19635  193.0
## 197 21965  193.0
## 198 26560  192.0
## 199 25920  189.0
## 200 26510  193.0
## 201 30920  192.0
## 202 23495  200.0
## 203 28800  200.0
## 204 22570  171.0
## 205 16695  171.0
## 206 18715  165.0
## 207 19825  168.0
## 208 21055  172.0
## 209 21055  161.0
## 210 23785  172.0
## 211 23215  161.0
## 212 23955  185.0
## 213 33180  185.0
## 214 39235  185.0
## 215 65000  204.0
## 216 75000  204.0
## 217 19005  174.0
## 218 24955  184.0
## 219 40235  184.0
## 220 25135   11.4
## 221 34845  180.0
## 222 37730  190.0
## 223 40565  186.0
## 224 42565  186.0
## 225 45210  190.0
## 226 26135  180.0

Pregunta 6

Create 3 new columns using my_new_data, the first one will be “Weight_kl” and change the weight of the vehicle from pounds to kilometers, the second one “WheelBase_cm” changes inches to centimeters, and the last column “Length_cm” also changes from inches to centimeters. Save everything in “my_new_data2”

preg6 <- my_data2 %>%
  select(Weight, Wheelbase, Length) %>%
  mutate(
    Weight_kl = Weight * 0.45359237,    # Convert pounds to kilograms
    WheelBase_cm = Wheelbase * 2.54,   # Convert inches to centimeters
    Length_cm = Length * 2.54          # Convert inches to centimeters
  )

Pregunta 7

Create a new column named “Opinion” and if the MSRP it’s lower than 29,000 you should have the word “Cheap” in the new column. If MSRP has a value between 29,000 and 64,000 write “Normal” and if it’s higher write “Expensive”

preg7 <- my_data2 %>%
  mutate(
    Opinion = case_when(
      MSRP < 29000 ~ "Cheap",
      MSRP >= 29000 & MSRP <= 64000 ~ "Normal",
      MSRP > 64000 ~ "Expensive",
    )
  )

Knit this file and deliver and html in Canvas