Is there any R function that can convert dates?

Asked

Viewed 123 times

2

inserir a descrição da imagem aqui

Good afternoon,

I’m new to the R language, and I need a little help. I wonder if there is a function that changes the timestamp date, it was to be time and date, only the database made available to me as it is in the image. I’ve been looking for some functions from given to R, but nothing applies to the situation that the data is available. Thank you

  • as.Date(as.POSIXct(timestamp, origin="1970-01-01"))

  • at the time of that comment Unix’s timespamp is 1525806060 (~ 1.5e9). What is the time (the value of zero, the value of Unix is 1970-01-01) for this timestamp greater than 1e12? data error face.

  • So, it’s very recent data, it’s not less than three months old that data, it’s data from a sensor, which captures the temperature every five seconds

  • A dput(head(dados)) would help

1 answer

2

Kicking over data from a sensor I don’t know.

The data can make some sense if: 1. The timestamp is recording in milliseconds; 2. They show the time needed to measure n samples.

To get timestamp time

as.POSIXct(1.523365e12/1000, origin="1970-01-01")
[1] "2018-04-10 09:56:40 BRT"

Look at the difference between the third and the first timespamp.

(1.523372e12 - 1.523365e12)/1000/5 = 1400

Which is close to the (698 + 697 = 1395) samples among the collections. Perhaps if the timestamp had an extra decimal place, it would have a more accurate value. But to confirm this, you’ll need the sensor manual.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.