Skip to content
Prev 13743 / 15274 Next

Convert double to date

Hi all, what appeared to be an easy task turns into a mystery - at least
judged
from my previous experience with other languages.

I queried some historical data from an exchange and stored into a double
array
a_fetchdata:
[1] "double"
NGFJ6.Open  NGFJ6.High
2016-02-09 07:30:00     0.2897      0.2897
#### Please note above result has no header for the date/time column

My goal is to take the date, deduct one day and arrive at "2016-02-08".

So I tried converting into a date (with paste/without paste)
or
strptime(c(a_fetchdata[1,0]),format="%Y%m%d")

But I keep running into the same error message:

*Error in dimnames(cd) <- list(as.character(index(x)), colnames(x)) :
'dimnames' applied to non-array*

Can anyone please shed some light on that?

Many thanks in advance,
Peter