-1

DATA as.POSIXct(DADOS1[c(3:n), c(1)], tz = "GMT", origin = "1970-01-01")

I have a dataset with many columns and I want to convert the first column which is a numeric number to a date. With the command that I am using it is giving an error: "Error in as.POSIXct.default(DADOS1[c(3:n), c(1)], tz = "GMT", origin = "1970-01-01") : do not know how to convert 'DADOS1[c(3:n), c(1)]' to class “POSIXct”"

1 Answers1

0

You can do something like this:

df <- data.frame(
  date = 20230301:20230401
)
df$date <- as.POSIXct(df$date, tz = "GMT", origin = "1970-01-01")

I am not sure what DADOS1 is. Could you please include an example data?

Shubham
  • 220
  • 2
  • 10