0

I have a column of numeric values and would like to convert this into a Winning percentage.

Winning percentage is defined like this:

Winning percentage = (Wins+0.5*Ties)/Total Values
  1. Calculate values that are higher, lower and equal in the list

  2. Divide by total number of values in the list.

So given a list of values:

106.32 
92.56
96.35
29.54
92.56
93.32

Win Pcts are:

1.000
0.417
0.833
0.000
0.417
0.667

This is as close as I got:

(length(which(dataframe[1,1] > dataframe[1]))/length(dataframe[,1]))
Cettt
  • 11,460
  • 7
  • 35
  • 58
Chequer
  • 31
  • 3
  • 2
    Hi, and welcome to StackOverflow. See [how to make a great reproducible example](https://stackoverflow.com/a/5963610/2359523) with how to improve your question, namely by providing an example dataset. Also, I may not completely understand, if you could clarify. What are you trying to calculate in 1? Isn't that just your total games? Or is that a score column? – Anonymous coward Jul 09 '18 at 15:50
  • 1
    Can you post sample data? Please edit the question with the output of `dput(season13)`. Or, if it is too big with the output of `dput(head(season13, 20))`. – Rui Barradas Jul 09 '18 at 15:51
  • sorry, I don't understand what a win is in your formula? – MatthewR Apr 26 '19 at 11:39

0 Answers0