Displaying 1 result from an estimated 1 matches for "dtch".
Did you mean:
atch
2013 Aug 16
1
as.Date.character speed improvement suggestion
...lt;- unique(x)
idx <- match(x, ux)
y <- as.Date.character(ux, ...)
return(y[idx])
}
as.Date.character(x, ...)
}
## Example1: Construct a 1-million length character vector of 1000 unique dates
## By considering only unique values, speed is >250x faster
> dtch <- format(sample(Sys.Date()-1:1000, 1e6, replace=TRUE))
> system.time(dt1 <- as.Date.character(dtch))
user system elapsed
12.630 23.628 36.262
> system.time(dt2 <- as.Date.character2(dtch))
user system elapsed
0.117 0.019 0.136
> identical(dt1, dt2)
[1] TRUE...