How to sort a data frame by date

前端 未结 7 744
孤城傲影
孤城傲影 2020-11-28 21:46

I need to sort a data frame by date in R. The dates are all in the form of \"dd/mm/yyyy\". The dates are in the 3rd column. The column header is V3. I have seen how to s

相关标签:
7条回答
  • 2020-11-28 22:21

    Assuming your data frame is named d,

    d[order(as.Date(d$V3, format="%d/%m/%Y")),]
    

    Read my blog post, Sorting a data frame by the contents of a column, if that doesn't make sense.

    0 讨论(0)
提交回复
热议问题