How to sort a data frame by date

前端 未结 7 845
孤城傲影
孤城傲影 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:15

    The only way I found to work with hours, through an US format in source (mm-dd-yyyy HH-MM-SS PM/AM)...

    df_dataSet$time <- as.POSIXct( df_dataSet$time , format = "%m/%d/%Y %I:%M:%S %p" , tz = "GMT")
    class(df_dataSet$time)
    df_dataSet <- df_dataSet[do.call(order, df_dataSet), ] 
    

提交回复
热议问题