-
Notifications
You must be signed in to change notification settings - Fork 0
/
p11.Rmd
78 lines (61 loc) · 1.85 KB
/
p11.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: "Analysis of the mtcars Dataset"
author: "T Sathiya
date: "27.05.2024"
output:
slidy_presentation: default
html_document:
number_sections: yes
toc: yes
ioslides_presentation: default
mode: selfcontained
job: Reproducible Pitch Presentation
subtitle: Variables and MPG
highlighter: highlight.js
widgets: bootstrap
---
## Coursera Reproducible Pitch
### Find all details here
URL: *https://www.coursera.org/learn/data-products/peer/tMYrn/course-project-shiny-application-and-reproducible-pitch*
---
## mtcars Dataset
### Motor Trend Car Road Tests
> The data was extracted from the 1974 Motor Trend US magazine, and comprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973-74 models).
### Source
> Henderson and Velleman (1981), Building multiple regression models interactively. Biometrics, 37, 391-411.
```{r}
library(datasets)
head(mtcars, 3)
```
---
## mtcars Dataset - Format
**A data frame with 32 observations on 11 variables.**
| Index | Field | Detail |
------- | ----- | ------ |
| [, 1] | mpg | Miles/(US) gallon |
| [, 2] | cyl | Number of cylinders |
| [, 3] | disp | Displacement (cu.in.) |
| [, 4] | hp | Gross horsepower |
| [, 5] | drat | Rear axle ratio |
| [, 6] | wt | Weight (lb/1000) |
| [, 7] | qsec | 1/4 mile time |
| [, 8] | vs | V/S |
| [, 9] | am | Transmission (0 = automatic, 1 = manual) |
| [,10] | gear | Number of forward gears |
| [,11] | carb | Number of carburetors |
---
## Analysis - Main Code
```r
formulaTextPoint <- reactive({
paste("mpg ~", "as.integer(", input$variable, ")") })
fit <- reactive({
lm(as.formula(formulaTextPoint()), data=mpgData) })
...
output$fit <- renderPrint({
summary(fit()) })
output$mpgPlot <- renderPlot({
with(mpgData, {
plot(as.formula(formulaTextPoint()))
abline(fit(), col=2)
}) })
```