1

As you can see the legend on the right hand side, I need to reorder it as 1,2,3,...64, not 1,10,11...,8. My term-document matrix is as follows. Please give me some ideas how to rearrange the code.

    A tibble: 4,530 x 5
   document       term count     n total
  <chr>      <chr> <dbl> <int> <dbl>
1        1      activ     1     1   109
2        10 agencydebt     1     1   109
3        10     assess     1     1   109
4        11      avail     1     1   109
5        11     balanc     2     1   109

The image of my histogram is here.

Florian
  • 24,425
  • 4
  • 49
  • 80
SChatcha
  • 129
  • 1
  • 3
  • 10

1 Answers1

2

Try this line before plotting:

df$document = factor(df$document, levels=sort(as.numeric(df$document)))

where df is the name of your dataframe.

Florian
  • 24,425
  • 4
  • 49
  • 80