I tried to create new variables from my data set. This is what I typed:
library(tidyverse)
dt4w05S <- read.csv("w05S.csv")
dt4w05S <- dt4w05S %>%
mutate(productPriceUnit = RetailPriceUnit/1.13,
productType =
ifelse(productPriceUnit>20,"Premium","Regular"),
Revenue = SalesQuantityproductPriceUnit,
productCost = SalesQuantityproductCostUnit,
grossProfit = Revenue - productCost,
Day = weekdays(SalesDate))
Then it said: Error in UseMethod("weekdays") :
no applicable method for 'weekdays' applied to an object of class "factor"
Anyone knows how to fix this?
Thank you.