Problem 1

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.

#data <- read.csv("Walmart_Sales.csv")
#View(data)
##install.packages("trelliscopejs")
#library(trelliscopejs)
#library(ggplot2)
#install.packages("tidyverse")
#library(tidyverse)

#data <- data %>% group_by(Store) %>% mutate(avgSales = mean(Weekly_Sales))
#data$avgSales <- cog(data$avgSales, desc = "Average Weekly Sales (mil) for store")

#data$Date <- as.Date(data$Date, format = "%d-%m-%Y")
#data$Year <- format(data$Date, "%Y")
#data$Weekly_Sales<- data$Weekly_Sales/1000000

#ggplot(data, aes(x = Year, y = Weekly_Sales, color = Year)) +
#  geom_col() +
#  facet_trelliscope(~Store,
                   # name = "Store Sales",
                   # desc = "Weekly best performing stores", scales= c("same", "same"), nrow =2, ncol =3, path = ".", self_contained = TRUE)


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.

# Description

# The dataset I chose to use is "Walmart_Sales" from Kaggle.com. Within the dataset there are different factor, included is the sales on a weekly basis for 9 different stores from the years 2010 to 2012. The variables are store ID, the date, weekly sales, holiday indicators, temperature and other factors that could possible influence store performance. 

# For this graph, I chose to use the variable Weekly_Sales. The variable shows the amount of money that the store location made for that week. In order for ease graphing, I scaled the sales into millions. The reason I chose this variable to investigate because it is an important indicator to stores to see how well it performs financially in comparison to other stores. This can show that possible factors like store location can indicate different performance levels. I chose to facet the variable Store, this allows for the reader to see and analyze the different store's performances over the period of 2 years. This makes it apparent which store have a trend of higher or lower sales overall. 

# Some challenges I had while making this graph was using the date column in the dataset. It was formatted as "m,d,y", and I needed the year to make the barplot. So in order to solve that I reformatted the data into the standard R format and then created a new column called Year that extracted the year from the date column. I also excluded the 7 store in the factor because when it included in the data, it would negatively affect the appearance of other graphs. The cognositc measure I created is avgSales, this contains the average weekly sales for each store. This helps us filter the panels in the trelliscope viewer. So by comparing the average sales, I or the viewer can quickly see the higher performing stores. From this we can see that store 4 has the highest performing sales. 

or go to https://rpubs.com/dom_w/1371450


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