Skip to content
Prev 385117 / 398503 Next

Parsing a Date

Hello,

I'm reposting, I sent the previous in HTML format.
My apologies, I'm not at my computers.

And another solution, taking advantage of Rasmus' one:


simplify2array(parallel::mclapply(c(
 ?"%Y",
 ?"%m",
 ?"%d",
 ?"%H"), function(fmt, x) {
 ?as.integer(format(as.POSIXct(x), format = fmt))
}, x = dta$forecast.date))
#???? [,1] [,2] [,3] [,4]
#[1,] 2020??? 8??? 1?? 12
#[2,] 2020??? 8??? 1?? 12
#[3,] 2020??? 8??? 1?? 12
#[4,] 2020??? 8??? 1?? 12
#[5,] 2020??? 8??? 1?? 12



The data set dta is Jeff's, it's in dput format.

Hope this helps,

Rui Barradas



?s 22:54 de 02/08/2020, Rui Barradas escreveu: