I have a big project to work on and the dataset is classified so I am just going to use my own example so everyone can understand what I am targeting.
Let's take Target as an example: We consider three brands of tape: Target brand, 3M and Avery. The original data frame has 4 columns: Year of Record, Product_Name(which contains three brands of tape), Sales, and Region.
The original data frame will look like this:
Year of Record Product_Name Sales Region
2018 Target_Brand 2000$ Midwest
... ... ... ...
2018 Avery 9000$ Central America
I want to create a visualization based on, for instance, region, sales, etc.
Should I use barplot?
Second question
My R code says this when I run multiple regression model:
data = read.excel(...) data1 = subset(data, Product_Name == "Target Brand")
model = lm(Product_Name ~ ., data1)
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels
In addition: Warning message:
In storage.mode(v) <- "double" : NAs introduced by coercion
How can I approach this scenario?
(P.S: My real dataset has about 36 columns and I truncate down to 21 columns. That is why I use the notation ~.)
I need help. Please give me guidance.