I have a factor column DATE
in a dataframe a
that shows dates written like this:
01/01/2012 00
It shows the day, the month, the year and the hour.
On stackoverflow I found this way to transform from factor to datetime:
a$DATE <- as.POSIXct(as.character(a$DATE), format = "%d/%m/%Y %H")
However when I try to check the dataframe by View(a)
I only get to see the date without the hour. All the dates appear like this:
2012-01-01
I have also tried to specify datetime by saving the dataframe in a csv and importing it again through the Rstudio button "Import Dataset". When I specify the type by clicking on the header of the DATE column I get the same error: the hour doesn't show.
Is the method I used correct? If yes, how can I show the hour? If it's not possible to show the hour, how can I get the hour from the POSIXct type?