You are viewing a single comment's thread. Return to all comments →
R solution: let me know if you have a better way to handle the output format (I was struggled)
plusMinus <- function(arr) { positive_ratio = sum(arr>0)/length(arr) negative_ratio = sum(arr<0)/length(arr) zero_ratio = sum(arr==0)/length(arr) cat(formatC(positive_ratio, format = "f", digits = 6)) cat("\n") cat(formatC(negative_ratio, format = "f", digits = 6)) cat("\n") cat(formatC(zero_ratio, format = "f", digits = 6)) }
Seems like cookies are disabled on this browser, please enable them to open this website
Plus Minus
You are viewing a single comment's thread. Return to all comments →
R solution: let me know if you have a better way to handle the output format (I was struggled)