I am trying to find the number of cars that are in inventory by week. I am having trouble counting the number of rows that meet a logical expression though. Here is what I have tried so far.
NCInv <- WeeklyVariableData$New %>%
group_by(WeekYear) %>%
nrow(WeeklyVariableData$New[WeeklyVariableData$New$DateAdded < WeeklyVariableData$New$`Contract Date`])
NCInv <- WeeklyVariableData$New %>%
group by(WeekYear) %>%
nrow(DateAdded < `Contract Date`)
NCInv <- WeeklyVariableData$New%>%
group_by(WeekYear) %>%
summarize(NCInv = sum(DateAdded < `Contract Date`))```