library(datasets)
data("bike_orderlines_tbl")
## Warning in data("bike_orderlines_tbl"): data set 'bike_orderlines_tbl' not
## found
summary("bike_orderlines_tbl")
## Length Class Mode
## 1 character character
Use ‘bike_orderline_tbl’. install.packages(“dplyr”) install.packages(“scales”) library(dplyr) library(scales)
Group and summarize the data calling the new column as ‘Sales’.
result <- bike_orderlines_tbl %>%
group_by(Prime category
= category_1,
Secondary category
= category_2,
Frame Material
= frame_material) %>% summarize(Sales =
sum(sales))
Format the sales as ‘dollars()’.
result\(Sales <-
dollar(result\)Sales)
Rename ‘category_1’ to ‘Prime category’, ‘category_2’ to ‘Secondary category’, ‘frame_material’ to ‘Frame Material’. colnames(result) <- c(‘Prime category’, ‘Secondary category’, ‘Frame Material’, ‘Sales’)