table unordered

When I use the function 'count' , the table comes out unordered. Why does it happen and how do I put 6-10 after 1-5 ?
Immagine

It is ordered... alphabetically. If you want to set the order of ore you will need to convert it to a factor.

See ?factor and the forcats package.

1 Like

The order of the rows in the data frame is not affected by the ordering of the factor, but you can easily reorder the data frame:

tempo <- tempo[order(tempo$Ore), ]

If you're learning the tidyverse you would use arrange() to order this way:

tempo <- tempo %>% arrange(Ore)
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.