Hello,
Normally the code is like that
betting_house <- c("B365", "BW", "IW", "PS", "WH", "VC")
row_max_prob <- function(df, row_idx, find_max){
predict_outcome = df[row_idx, "predict_outcome"]
if (is.na(predict_outcome)) return (NA)
col_names <- paste0(betting_house, predict_outcome)
val = ifelse(find_max, max(df[row_idx,col_names]), 1/mean(as.numeric(df[row_idx,col_names])))
return (val)
}
It was a little mistake in the previous code. Seems to me row_idx should be number value so how can I populate it?
Thanks as well for you answer.