Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---
- title: "A16 by Noah Perry & Andrew Hall"
- output:
- flexdashboard::flex_dashboard:
- orientation: columns
- vertical_layout: fill
- ---
- ```{r setup, include=FALSE}
- library(tidyverse)
- library(flexdashboard)
- library(ggthemes)
- library(plotly)
- #Read the Manheim data file <http://www.richardtwatson.com/data/manheim.csv> and create a 2x2 dashboard using flexdashboard showing.
- manheim <- read_csv("http://www.richardtwatson.com/data/manheim.csv")
- manheim <- as_tibble(manheim)
- manheim$sale<-as.factor(manheim$sale)
- manheim$model<-as.factor(manheim$model)
- manheim
- obsTable <- xtabs(~sale+model, data=manheim)
- ```
- Row
- -------------------------------------
- ### Frequency of each type of sale for each different model
- ```{r}
- #A table with the number of observations for each combination of the sale and model factors (use xtabs).
- ftable(obsTable)
- ```
- ### Box Plot showing Plotting distributions for type of sale and amount of sale
- ```{r}
- #A boxplot of price by sale
- g <- ggplot(manheim, aes(sale, price))
- g + geom_boxplot(varwidth=T, fill="plum") +
- labs(title="Box plot: Price by sale",
- x="Sales",
- y="Sales")
- ggplotly(p = ggplot2::last_plot())
- ```
- Row
- -------------------------------------
- ### Plotting price vs mileage for each type of sale
- ```{r}
- #A scatter plot of miles by price for each model
- ggplot(manheim, aes(x=miles, y=price, color = model)) +
- geom_point()
- ggplotly(p = ggplot2::last_plot())
- ```
- ### Plotting price vs mileage for each type of sale
- ```{r}
- #A scatter plot of miles by price for each sale
- #Submit a pdf of the code and the dashboard.
- ggplot(manheim, aes(x=miles, y=price, color = sale)) +
- geom_point()
- ggplotly(p = ggplot2::last_plot())
- ```
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement