-2

I have a dataset, named the counted. It contains information about all the people who have been killed by US police officers in 2015. Currently, the dataset is ordered according to the day of year when these people have been killed.

What I would like to do is rearranging the dataset according to the state where they have been killed How can I do that in R?

Here is a summary description of my dataset:

   uid                         name           age                 gender    
 Min.   :   2.0   Robert Edwards    :   3   24     : 46   Female        :  53  
 1st Qu.: 289.8   John Allen        :   2   25     : 41   Male          :1086  
 Median : 580.5   Jose Rodriguez    :   2   35     : 40   Non-conforming:   1  
 Mean   : 582.2   Miguel Martinez   :   2   28     : 38                        
 3rd Qu.: 875.2   Unknown           :   2   31     : 38                        
 Max.   :1164.0   A'donte Washington:   1   34     : 38                        
                  (Other)           :1128   (Other):899                        
                raceethnicity       month          day             year     
 White                 :578   July     :123   Min.   : 1.00   Min.   :2015  
 Black                 :303   March    :114   1st Qu.: 8.00   1st Qu.:2015  
 Hispanic/Latino       :194   April    :102   Median :15.00   Median :2015  
 Asian/Pacific Islander: 24   August   :102   Mean   :15.64   Mean   :2015  
 Unknown               : 23   September: 95   3rd Qu.:23.00   3rd Qu.:2015  
 Native American       : 13   December : 94   Max.   :31.00   Max.   :2015  
 (Other)               :  5   (Other)  :510                                 
                    streetaddress            city          state               classification
                           :   6   Los Angeles :  20   CA     :210   Death in custody :  41  
 Unknown                   :   3   Houston     :  17   TX     :108   Gunshot          :1015  
 13630 Veterans Memorial Dr:   2   Las Vegas   :  12   FL     : 71   Other            :   1  
 1800 E San Bernardino Ave :   2   Chicago     :  10   AZ     : 44   Struck by vehicle:  33  
 2040 California Ave       :   2   Indianapolis:  10   GA     : 39   Taser            :  50  
 4700 W Erie St            :   2   Phoenix     :  10   OK     : 38                           
 (Other)                   :1123   (Other)     :1061   (Other):630                           
                                  lawenforcementagency     armed    
 Los Angeles Police Department              :  23      Firearm:554  
 Los Angeles County Sheriff's Department    :  15      No     :224  
 Houston Police Department                  :  11      Knife  :155  
 Chicago Police Department                  :  10      Other  : 61  
 New York Police Department                 :  10      Unknown: 59  
 Indianapolis Metropolitan Police Department:   9      Vehicle: 43  
 (Other)                                    :1062      (Other): 44
zx8754
  • 52,746
  • 12
  • 114
  • 209
Laurent
  • 1
  • 2
  • Welcome to Stack Overflow! Please read the info about [how to ask a good question](http://stackoverflow.com/help/how-to-ask) and how to give a [reproducible example](http://stackoverflow.com/questions/5963269). This will make it much easier for others to help you. – zx8754 Mar 15 '16 at 15:07

1 Answers1

0

May be you can use something as simple as order function.

dataframe<-dataframe[,order(state),decreasing=TRUE)]

You can try this.

RVRLibra
  • 63
  • 1
  • 12