I am basically trying to work a confusion matrix with some prediction / response variables under a couple of conditions, but im not sure how to lay out the code.
for my prediction values, my current code is:
Prediction <- factor (rep(data$percentage <=40.0 || data$binary ==1,levels=c("TRUE","FALSE")))
but I am pretty sure this is incorrect because what I want to achieve is the following conditions:
Any help would be much appreciated !
not to hard code, I worked directly on your data frame;
library(dplyr)
data %>%
mutate(logistic_column=rowSums(data)) %>%
mutate(prediction=ifelse(is.na(logistic_column),
ifelse(binary==1,TRUE,FALSE),
ifelse(percentage<=40,TRUE,FALSE))) %>%
select(prediction) %>%
pull -> prediction