Search code examples
rdataframeplotfilterdatatable

How to find number of rows greater than any values in R


I want to have table and plot for number of rows greater than any specific values in column for example number of rows greater than 74, number of rows greater than 51 and ...

table (data$weight) just calculate the number of 74, number of 51 and ... but not greater than this value. I want to have linear plot of this. anybody can help? thanks in advance.

data:
    height     weight  
2th     192     74   
8th     185     51  
4th     174     50    
3th     173     83  
5th     172     74    
7th     171     66 
10th    170     51  
1th     167     86  
6th     167     66     
9th     163     50 

table (data$weight)


Solution

  • As per the comments:

    table(datain$weight) |> 
      rev() |> 
      cumsum() |> 
      rev()
    

    gives:

    50 51 66 74 83 86 
    10  8  6  4  2  1