我正在尝试计算模型的残差平方。但我不断收到错误
错误$ residuals中的错误:$运算符对原子向量无效。
attach(delivery_time)
plot(log(`Sorting Time`), `Delivery Time`)
cor(log(`Sorting Time`), `Delivery Time`)
reg <- lm(`Delivery Time` ~ log(`Sorting Time`))
summary(reg)
deliveryer <- predict(reg)
errordelivery <- exp(deliveryer)
deliverytime = delivery_time$`Delivery Time`- errordelivery
deliverytime$residuals
sqrt(mean(deliverytime$residuals^2))
deliverytime $ residuals中的错误: $运算符对原子向量无效