-4

I have data loaded via read.csv() ans looks like something like this.

> head(dt)
                                                                             X.U.FEFF.
1 |Gender:Male and suice month:October and reason:Divorce|2010|9.0|
2                                                                         ||2011|10.0|
3                                                                         ||2012|17.0|
4                                                                         ||2013|16.0|
5                                                                         ||2014|16.0|
6                                                                         ||2015|14.0|

I need the suicide total number each years depens on the gender.How can I achive this.

msa
  • 1

1 Answers1

0

I'm not sure if I really understand the question, but if you're just trying to reorder a data frame according to gender, then maybe you should take a look at this How to sort a dataframe by column(s)?

dt <- dt[with(dt, order(gender)),]

Community
  • 1
  • 1
beemyfriend
  • 85
  • 10