R/subtyper.R
complete_cases_from_equation.Rd
This function takes a data frame and a model equation as input, and returns a boolean vector indicating which rows of the data frame have complete cases for the variables specified in the equation.
complete_cases_from_equation(df, equation)
A boolean vector indicating which rows of the data frame have complete cases.
df <- data.frame(
x = c(1, 2, NA, 4),
y = c(NA, 2, 3, 4),
z = c(1, 2, 3, NA)
)
equation <- y ~ x + z
complete_index <- complete_cases_from_equation(df, equation)
print(complete_index) # Output: FALSE TRUE FALSE FALSE
#> [1] FALSE TRUE FALSE FALSE