cars <- mtcars
ggplot(cars, aes(wt, mpg)) +
geom_point()

ggsave("outputs/cars-wt-mpg.png")
## Saving 7 x 5 in image
ggplot(cars, aes(hp, mpg)) + geom_point()

ggsave("outputs/cars-hp-mpg.png")
## Saving 7 x 5 in image
lm.cars.wt.mpg <- lm(mpg ~ wt, data= cars)
anova(lm.cars.wt.mpg)
## Analysis of Variance Table
##
## Response: mpg
## Df Sum Sq Mean Sq F value Pr(>F)
## wt 1 847.73 847.73 91.375 1.294e-10 ***
## Residuals 30 278.32 9.28
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
cars$cyl <- as.factor(cars$cyl)
cars.summary1 <- summarize(group_by(cars, cyl), .groups = "keep",
n=n(),
mean=mean(mpg),
sd=sd(mpg))
kable(cars.summary1, format = "pandoc", caption = 'Table 1. A summary kable displaying number, mean, and standard deviation of gas mileage for each of three cylinder options for cars.')
Table 1. A summary kable displaying number, mean, and standard deviation of gas mileage for each of three cylinder options for cars.
| 4 |
11 |
26.66364 |
4.509828 |
| 6 |
7 |
19.74286 |
1.453567 |
| 8 |
14 |
15.10000 |
2.560048 |
cars.summary2 <- summarize(group_by(cars, gear),
n= n(),
mean= mean(mpg),
sd= sd(mpg))
## `summarise()` ungrouping output (override with `.groups` argument)
kable(cars.summary2, format= "pandoc", caption= "Table 2. A summary kable displaying the number, mean, and standard deviation of gas mileage for each of three gear options in cars.")
Table 2. A summary kable displaying the number, mean, and standard deviation of gas mileage for each of three gear options in cars.
| 3 |
15 |
16.10667 |
3.371618 |
| 4 |
12 |
24.53333 |
5.276764 |
| 5 |
5 |
21.38000 |
6.658979 |
leaflet() %>%
setView(-122.283770, 37.832750, zoom = 16) %>% #lat-long of the place of interest
addTiles() %>%
addMarkers(-122.283770, 37.832750, popup = "Cars Animation Studio")
This is where you can go to learn more about
Cars the film.