Sales is a variable in the dataset train. Summary() finds it, but not glm(). What's going on?
Any help is appreciated.
> summary(train$Sales)
Min. 1st Qu. Median Mean 3rd Qu. Max.
0 3727 5744 5774 7856 41550
> summary(ross_glm <- glm(Sales ~ Customers,family=Gamma,data = train[Sales>0]))
Error in `[.data.frame`(train, Sales > 0) : object 'Sales' not found
P.S. I've tried referencing using train$Sales and also attaching the train dataset, but they don't resolve the problem.
train[train$Sales>0,]. See for example:set.seed(42); train <- data.frame(Sales = rnorm(100), Other = rnorm(100)); train[Sales>0]. - user3710546summary(ross_glm <- glm(Sales ~ Customers,family=Gamma,data = train, subset = Sales>0)- Ben Bolker