For a data set of your choosing, make a faceted plot using the trelliscopejs package. You may make any type of plot; scatter plot, histogram, etc. but, as mentioned in the discussion below, you must explain why you chose this plot and what you are investigating about the variable you are graphing.
The trelliscope plot must include one cognostic measure of your own. Include a description of what it is and what information this measure gives.
Description 2-3 paragraphs.
Describe the data set. Explain the variable you are graphing in your plots and the reason you are investigating with it. Discuss the reason/motivation you chose the variable to facet on, and what insight or trend you are attempting to investigate. Discuss any challenges you had in making the graphs and how you dealt with these challenges. Name at least one cognostic measure (this can include the cognostic you created or be different) the reader could investigate, and explain any insight they might gain from it.
knit the file to an html document
publish this to an RPubs page.
grading: trelliscope plot[25 points], discussion[25 points]
Note: you can add a url directly to the text and it will be active in the html (and word document if you knit to that)
Example: https://www.google.com
If you want to be fancy and make your url active text, you can do this
# Load required libraries
install.packages("trelliscopejs")
## Installing package into 'C:/Users/laure/AppData/Local/R/win-library/4.3'
## (as 'lib' is unspecified)
## package 'trelliscopejs' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\laure\AppData\Local\Temp\Rtmpai1xMZ\downloaded_packages
library(trelliscopejs)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.5
## ✔ forcats 1.0.0 ✔ stringr 1.5.1
## ✔ ggplot2 3.5.0 ✔ tibble 3.2.1
## ✔ lubridate 1.9.3 ✔ tidyr 1.3.1
## ✔ purrr 1.0.2
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggplot2)
Adidas_Sales_2021 <- read.csv("AdidasSalesdata_21.csv")
Adidas_Sales_2021 %>%
filter(!is.na(Product.Category))
# Calculate the cognostic measure
average_profit_margin <- Adidas_Sales_2021 %>%
summarise(avg_profit_margin = mean(Operating.Margin, na.rm = TRUE))
ggplot(Adidas_Sales_2021, aes(x = Price.per.Unit, y = Units.Sold)) +
geom_point() +
facet_trelliscope(~Product.Category,
name = "Product Category",
desc = "Adidas product sales data for 2021",
nrow = 2, ncol = 3,
scales =c("same","same"),
path = ".",
self_contained = TRUE)
## using data from the first layer
or go to web https://rpubs.com/Okumsika/1172225
Adidas_Sales_2021 dataset, contains information about Adidas product sales for the year 2021. The dataset includes variables such as Retailer, Invoice Date, Region, Product Category, Price per Unit, Units Sold, Total Sales, Operating Profit, Operating Margin, and Sales Method.
I am graphing the relationship between the price per unit and the units sold for Adidas products using a scatter plot. This plot will be faceted by the product category. The motivation behind this analysis is to understand how the price per unit affects the number of units sold across different product categories. By examining this relationship, we can identify which product categories are more price-sensitive and which ones are not.
In making the graph some challenges encountered include dealing with large amounts of data,missing or no entries and ensuring that the plot is visually appealing and informative. I addressed these challenges by filtering out missing values and, ensuring that the plot is properly labeled and had good aesthetics for clarity and readability.
One cognostic measure that I will include is the average operating margin for each product category. The operating margin is a measure of a company’s profitability, calculated as operating profit divided by total sales. By examining the average operating margin for each product category, we can gain insights into the profitability of different product categories and identify areas for improvement or optimization.