title: Rounding percentages to 100% in R
body: <p>I have a set of percentages in R which I want to make equal to 100%. I need the individual percentages to be to the nearest integer. </p>
  
  <p>I have rounded percentages [20.5, 50.6, 25.8 , 3.1].Then I am rounding to the nearest integer [ 20,50,25,3].Then working out the individual decimal places [0.5,0.6,0.8.0.1].Then sorting the decimal places in descending order but output are [ 3,2,1,4].And I need to add 1 to the integer of the highest decimal place until I reach 100.</p>