Relative Content

Tag Archive for rdatetimeposixct

Converting datetime from chr to datetime format using POSIXct function in R

I am learning to code in R and currently doing the Bellabeat Google Data Analytics Capstone project. For this, I need to transform a column with datetime values (i.e. 4/12/2016 12:00:00 AM) formatted as characters to a datetime format. I have been trying to use the as.POSIXct function, but everytime I do so, the entire column values change to NA. I looked up the problem and found that it is most likely because the I have a typo in the format string of the POSIXct function. However, I have verified that the format codes I am using are correct, as well as the order and the spaces in between. Yet, the function keeps changing the values to NA. I need help finding what is wrong with the way I am writing the function, please !