Sort Data in R [closed]

0

I have a dataset:

MATRICULA <- c(111,222,444,1010,1020,777,888,999,555,666,333)
VALOR <- c(1000,2000,4000,10000,11000,7000,8000,9000,5000,6000,3000)
DADOS <- data.frame(MATRICULA, VALOR)

How to perform separately on the tag the following two operations for the previously proposed?

  • Order remarks from DADOS from highest VALOR to lowest;
  • Based on this ordering, I would like to select only the registrations that represent up to 50% of the total .
  • In short, how do you sort the observations in a% w of% by the value of a column and select the observations that accumulate 50% of the value using the new data.frame sorted?

    My result should have only the registrations 1020,1010 and 999. In addition to the result only the 3 registrations, I would like the data.frame column to also be displayed.

    Thank you!

        
    asked by anonymous 28.12.2018 / 14:14

    0 answers