languageserver
languageserver copied to clipboard
Incorrect `variable assigned but may not be used` warning
With the following minimal-ish code snippet, I'm getting a warning that model was assigned but may not be used:
boot_wls <- function(data, indices) {
data <- data[indices, ]
model <- lm(y ~ x1 + x2 + x3, data)
w <- 1 / fitted(lm(abs(residuals(model)) ~ x1 + x2 + x3, data))^2
w
}