knitr::opts_chunk$set(echo = TRUE)

R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

plot1 <- transactions_sample %>% inner_join(demographics)
## Joining, by = "household_id"
plot1 %>% filter(quantity > 10000) %>% ggplot(aes(x = household_size, y = quantity)) + geom_point(color = "red") + stat_summary(fun = "median", gemo = "point", color = "blue") + labs(title = "Quantity purchased per Household Size", subtitle = "Transactions Quantity greater than 10000", x = "Household Size", y = "Quantity") 
## Warning: Ignoring unknown parameters: gemo
## Warning: Removed 5 rows containing missing values (geom_segment).

Including Plots

You can also embed plots, for example:

plot2 <- transactions_sample %>% inner_join(demographics)
## Joining, by = "household_id"
plot2 %>% filter(household_id > 2000) %>% ggplot(aes(x = household_size, fill = income)) + geom_bar(position = "fill") + scale_y_continuous(seq(0, 1), labels = scales::percent) + labs(title = "Income Level per Household Size", subtitle = "Percentage of each Income Level", x = "Household Size", y = "Percentage")

plot3 <- transactions_sample %>% inner_join(products)
## Joining, by = "product_id"
plot3 %>% ggplot(aes(x = sales_value, y = department)) + geom_point(aes(color = brand)) + labs(title = "Sales Value per Department", subtitle = "Brands Labeled", x = "Sales Value", y = "Department")

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.