0

this is my dataframe:

df<-structure(list(InstrumentSymbol = c("AALR3", "AALR3", "AALR3", 
"AALR3"), SessionDate = structure(c(18072, 18072, 18072, 18072
), class = "Date"), TradeDateTime = structure(c(1561467600, 1561467900, 
1561468200, 1561468500), class = c("POSIXct", "POSIXt"), tzone = "America/Sao_Paulo"), 
    n.trades = c(16L, 7L, 16L, 8L)), row.names = c(NA, 4L), class = "data.frame")

As you can see column 3 has the date and the time date together. How can I simply split this two variables in two columns? The third column should be a date and the fourth time date.

Any help?

Laura
  • 675
  • 10
  • 32
  • 1
    `tidyr::separate(df, TradeDateTime, into = c("Date", "Time"), sep = " ") ` ? – Ronak Shah Sep 17 '19 at 01:42
  • try and include the code you have tried and any errors you get so we can help you quicker – morgan121 Sep 17 '19 at 01:42
  • @RonakShah I will delete the question. Its is duplicated. Trully, sorry. – Laura Sep 17 '19 at 01:48
  • 1
    no, it's okay no need to delete the question. It might redirect others to the correct post who land up here in the future. – Ronak Shah Sep 17 '19 at 01:51
  • Since R does not have a time class, I would recommend keeping the date and time combine and then using the format function to control the output when needed. – Dave2e Sep 17 '19 at 02:13

0 Answers0