So, I tried this and got this error: (attempt to give result for when test fails)
jorge %>%
mutate(result = ifelse(c(Called_Strike == 1 & Out_zone == 1 | Ball == 1 & In_zone == 1),
"stolenK", "lostK" , 0))-> jorge
Error in ifelse(c(Called_Strike == 1 & Out_zone == 1 | Ball == 1 & In_zone == :
unused argument (0)
And this and received this error:
jorge %>%
mutate(result = ifelse(c(Called_Strike == 1 & Out_zone == 1 | Ball == 1 & In_zone == 1),
"stolenK" | "lostK" , 0))-> jorge
Error in "stolenK" | "lostK" :
operations are possible only for numeric, logical or complex types
I am confused on the second error as the variables are numerics
I am confused overall. I have never tried to combine two things in one if else and have no reference
Also, I do not know how mutate decides between stolen or lost. And truthfully I don’t have a clue.
would you mind offering a solution where you explain the answers to your questions. I understand what you are saying. first, is the first part of the statement correct?
mutate(result = ifelse(c(Called_Strike == 1 & Out_zone == 1 | Ball == 1 & In_zone == 1)
is that satisfactory or does it need adjustment? and second, if you would a solution w explanation... or more guided questions at least?
Thanks
Stephen