-
Notifications
You must be signed in to change notification settings - Fork 0
/
MechaCarChallenge_D2.R
20 lines (14 loc) · 922 Bytes
/
MechaCarChallenge_D2.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
library(dplyr)
mechacar_mpg <-read.csv("MechaCar_mpg.csv", header= T, sep=",", check.names=F, stringsAsFactors=F)
# Generate multiple Linear regression model
lm(mpg ~ vehicle_length + vehicle_weight + spoiler_angle + ground_clearance + AWD, data=mechacar_mpg)
# Generate summary statistics
summary(lm(mpg ~ vehicle_length + vehicle_weight + spoiler_angle + ground_clearance + AWD, data=mechacar_mpg))
######## DELIVERABLE 2
# Import and read csv file
suspension_coil <- read.csv('Suspension_coil.csv', header=T, sep=",", check.names=F, stringsAsFactors=F)
# Create a summary table
total_summary <- suspension_coil %>% summarize(Mean=mean(PSI), Median=median(PSI), Variance=var(PSI), SD=sd(PSI))
total_summary
# Create a summary table grouped by lot number
lot_summary <- suspension_coil %>% group_by(Manufacturing_Lot) %>% summarize(Mean=mean(PSI), Median=median(PSI), Variance=var(PSI), SD=sd(PSI), .groups='keep')