Learn R Programming

icd9 (version 1.3.1)

fastIntToStringStd: fast convert integer vector to character vector

Description

fast convert integer vector to character vector

Usage

fastIntToStringStd(x)
fastIntToStringRcpp(x)

Arguments

x
td::vector
bufferSize
int if any input strings are longer than this number (default 16) there will be memory errors. No checks done for speed.

Examples

Run this code
## Not run: 
# pts <- randomPatients(1e7)
# # conclusion: buffer size matters little (so default to be more generous), and Rcpp version fastest.
# microbenchmark::microbenchmark(fastIntToStringStd(pts$visitId, buffer = 8),
#                                fastIntToStringStd(pts$visitId, buffer = 16),
#                                fastIntToStringStd(pts$visitId, buffer = 64),
#                                fastIntToStringRcpp(pts$visitId, buffer = 8),
#                                fastIntToStringRcpp(pts$visitId, buffer = 16),
#                                fastIntToStringRcpp(pts$visitId, buffer = 64),
#                                as.character(pts$visitId),
#                                asCharacterNoWarn(pts$visitId), times = 5)
# ## End(Not run)

Run the code above in your browser using DataLab