0

first my timestamp column was correct like this: timestamp <dttm 2019-11-02 00:25:00. But i dont want the seconds, so i deleted them with: df$timestamp <- format(df$timestamp,format= "%Y-%m-%d %H:%M")

it worked, but changed my timestamp to a character: timestamp <chr "2019-11-02 00:00"

I tried converting it back as a dttm with the correct format given: df$timestamp <- format(as.POSIXct(timestamp), '%Y-%m-%d %H:%M')

but i get the following error: Error in as.POSIXct.default(timestamp) : do not know how to convert 'timestamp' to class “POSIXct”

I need my timestamp without seconds as dttm. Does someone sees where i am going wrong ? any help is appreciated. Thankyou

EvA
  • 65
  • 5
  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. List all non-base R packages you are using. – MrFlick Feb 17 '21 at 21:15
  • I dont know how to input an example, i am using library (fpp3) and library(tidyr) to fill in gaps that were in the timestamp – EvA Feb 17 '21 at 21:24
  • 1
    Is it possible to have a dttm without seconds? I get that they can be ignored and set to ```00```, but that is not the same as not being part of the format. – rjen Feb 17 '21 at 21:50

0 Answers0