Quiz 1

pdf

School

Montgomery College *

*We aren’t endorsed by this school

Course

101

Subject

Statistics

Date

Apr 3, 2024

Type

pdf

Pages

6

Uploaded by GrandSparrowMaster909

Report
Quiz 1 MA 2024-02-21 Please use the following data set to answer the below questions: library (tidyverse) ## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ── ## dplyr 1.1.4 readr 2.1.5 ## forcats 1.0.0 stringr 1.5.1 ## ggplot2 3.4.4 tibble 3.2.1 ## lubridate 1.9.3 tidyr 1.3.1 ## purrr 1.0.2 ## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ── ## dplyr::filter() masks stats::filter() ## dplyr::lag() masks stats::lag() ## Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to becom e errors mtcars
## mpg cyl disp hp drat wt qsec vs am gear carb ## Mazda RX4 21.0 6 160.0 110 3.90 2.620 16.46 0 1 4 4 ## Mazda RX4 Wag 21.0 6 160.0 110 3.90 2.875 17.02 0 1 4 4 ## Datsun 710 22.8 4 108.0 93 3.85 2.320 18.61 1 1 4 1 ## Hornet 4 Drive 21.4 6 258.0 110 3.08 3.215 19.44 1 0 3 1 ## Hornet Sportabout 18.7 8 360.0 175 3.15 3.440 17.02 0 0 3 2 ## Valiant 18.1 6 225.0 105 2.76 3.460 20.22 1 0 3 1 ## Duster 360 14.3 8 360.0 245 3.21 3.570 15.84 0 0 3 4 ## Merc 240D 24.4 4 146.7 62 3.69 3.190 20.00 1 0 4 2 ## Merc 230 22.8 4 140.8 95 3.92 3.150 22.90 1 0 4 2 ## Merc 280 19.2 6 167.6 123 3.92 3.440 18.30 1 0 4 4 ## Merc 280C 17.8 6 167.6 123 3.92 3.440 18.90 1 0 4 4 ## Merc 450SE 16.4 8 275.8 180 3.07 4.070 17.40 0 0 3 3 ## Merc 450SL 17.3 8 275.8 180 3.07 3.730 17.60 0 0 3 3 ## Merc 450SLC 15.2 8 275.8 180 3.07 3.780 18.00 0 0 3 3 ## Cadillac Fleetwood 10.4 8 472.0 205 2.93 5.250 17.98 0 0 3 4 ## Lincoln Continental 10.4 8 460.0 215 3.00 5.424 17.82 0 0 3 4 ## Chrysler Imperial 14.7 8 440.0 230 3.23 5.345 17.42 0 0 3 4 ## Fiat 128 32.4 4 78.7 66 4.08 2.200 19.47 1 1 4 1 ## Honda Civic 30.4 4 75.7 52 4.93 1.615 18.52 1 1 4 2 ## Toyota Corolla 33.9 4 71.1 65 4.22 1.835 19.90 1 1 4 1 ## Toyota Corona 21.5 4 120.1 97 3.70 2.465 20.01 1 0 3 1 ## Dodge Challenger 15.5 8 318.0 150 2.76 3.520 16.87 0 0 3 2 ## AMC Javelin 15.2 8 304.0 150 3.15 3.435 17.30 0 0 3 2 ## Camaro Z28 13.3 8 350.0 245 3.73 3.840 15.41 0 0 3 4 ## Pontiac Firebird 19.2 8 400.0 175 3.08 3.845 17.05 0 0 3 2 ## Fiat X1-9 27.3 4 79.0 66 4.08 1.935 18.90 1 1 4 1 ## Porsche 914-2 26.0 4 120.3 91 4.43 2.140 16.70 0 1 5 2 ## Lotus Europa 30.4 4 95.1 113 3.77 1.513 16.90 1 1 5 2 ## Ford Pantera L 15.8 8 351.0 264 4.22 3.170 14.50 0 1 5 4 ## Ferrari Dino 19.7 6 145.0 175 3.62 2.770 15.50 0 1 5 6 ## Maserati Bora 15.0 8 301.0 335 3.54 3.570 14.60 0 1 5 8 ## Volvo 142E 21.4 4 121.0 109 4.11 2.780 18.60 1 1 4 2 data <- mtcars Question 1: Can you provide a summary of the mpg (miles per gallon) column in the mtcars dataset? #enter your code here summary(mpg)
## manufacturer model displ year ## Length:234 Length:234 Min. :1.600 Min. :1999 ## Class :character Class :character 1st Qu.:2.400 1st Qu.:1999 ## Mode :character Mode :character Median :3.300 Median :2004 ## Mean :3.472 Mean :2004 ## 3rd Qu.:4.600 3rd Qu.:2008 ## Max. :7.000 Max. :2008 ## cyl trans drv cty ## Min. :4.000 Length:234 Length:234 Min. : 9.00 ## 1st Qu.:4.000 Class :character Class :character 1st Qu.:14.00 ## Median :6.000 Mode :character Mode :character Median :17.00 ## Mean :5.889 Mean :16.86 ## 3rd Qu.:8.000 3rd Qu.:19.00 ## Max. :8.000 Max. :35.00 ## hwy fl class ## Min. :12.00 Length:234 Length:234 ## 1st Qu.:18.00 Class :character Class :character ## Median :24.00 Mode :character Mode :character ## Mean :23.44 ## 3rd Qu.:27.00 ## Max. :44.00 ##Question 2: How can you access the information for the 5th row in the mtcars dataset? #enter your code here select(data, drat)
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
## drat ## Mazda RX4 3.90 ## Mazda RX4 Wag 3.90 ## Datsun 710 3.85 ## Hornet 4 Drive 3.08 ## Hornet Sportabout 3.15 ## Valiant 2.76 ## Duster 360 3.21 ## Merc 240D 3.69 ## Merc 230 3.92 ## Merc 280 3.92 ## Merc 280C 3.92 ## Merc 450SE 3.07 ## Merc 450SL 3.07 ## Merc 450SLC 3.07 ## Cadillac Fleetwood 2.93 ## Lincoln Continental 3.00 ## Chrysler Imperial 3.23 ## Fiat 128 4.08 ## Honda Civic 4.93 ## Toyota Corolla 4.22 ## Toyota Corona 3.70 ## Dodge Challenger 2.76 ## AMC Javelin 3.15 ## Camaro Z28 3.73 ## Pontiac Firebird 3.08 ## Fiat X1-9 4.08 ## Porsche 914-2 4.43 ## Lotus Europa 3.77 ## Ford Pantera L 4.22 ## Ferrari Dino 3.62 ## Maserati Bora 3.54 ## Volvo 142E 4.11 Question 3: What is the maximum value in the wt (weight) column of the mtcars dataset? #enter your code here m<- select(data, wt) mean(m) ## Warning in mean.default(m): argument is not numeric or logical: returning NA ## [1] NA
Question 4: Create a new dataframe selected_cars with only the columns ‘mpg’, ‘hp’, and ‘qsec’ from the mtcars dataset. #enter your code here selected_cars<- select(data, mpg, hp, qsec) selected_cars ## mpg hp qsec ## Mazda RX4 21.0 110 16.46 ## Mazda RX4 Wag 21.0 110 17.02 ## Datsun 710 22.8 93 18.61 ## Hornet 4 Drive 21.4 110 19.44 ## Hornet Sportabout 18.7 175 17.02 ## Valiant 18.1 105 20.22 ## Duster 360 14.3 245 15.84 ## Merc 240D 24.4 62 20.00 ## Merc 230 22.8 95 22.90 ## Merc 280 19.2 123 18.30 ## Merc 280C 17.8 123 18.90 ## Merc 450SE 16.4 180 17.40 ## Merc 450SL 17.3 180 17.60 ## Merc 450SLC 15.2 180 18.00 ## Cadillac Fleetwood 10.4 205 17.98 ## Lincoln Continental 10.4 215 17.82 ## Chrysler Imperial 14.7 230 17.42 ## Fiat 128 32.4 66 19.47 ## Honda Civic 30.4 52 18.52 ## Toyota Corolla 33.9 65 19.90 ## Toyota Corona 21.5 97 20.01 ## Dodge Challenger 15.5 150 16.87 ## AMC Javelin 15.2 150 17.30 ## Camaro Z28 13.3 245 15.41 ## Pontiac Firebird 19.2 175 17.05 ## Fiat X1-9 27.3 66 18.90 ## Porsche 914-2 26.0 91 16.70 ## Lotus Europa 30.4 113 16.90 ## Ford Pantera L 15.8 264 14.50 ## Ferrari Dino 19.7 175 15.50 ## Maserati Bora 15.0 335 14.60 ## Volvo 142E 21.4 109 18.60 Question 5: a. What is the average horsepower (hp) of the cars in the mtcars dataset? b)How many cars have horsepower greater than the average?
# enter your code here #a) mean(data, hp, na.rm=TRUE) ## Warning in mean.default(data, hp, na.rm = TRUE): argument is not numeric or ## logical: returning NA ## [1] NA
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help