Displaying 1 result from an estimated 1 matches for "pn_len".
Did you mean:
in_len
2009 Mar 18
2
Profiling question: string formatting extremely slow
...im <- function (x) {
sub("^\\s+((.*\\S)\\s+)?$", "\\2", x)
}
# P/N formatting
pn_formatting <- function(pn_in) {
pn_out = trim(pn_in)
if (digits_only(pn_out)) {
# Zero padding
pn_out <- paste("000000000000000000", pn_out, sep="")
pn_len <- nchar(pn_out)
pn_out <- substr(pn_out, pn_len - 17, pn_len)
} else {
# Uppercase
pn_out <- toupper(pn_out)
}
pn_out
}
Thanks,
Olivier.
[[alternative HTML version deleted]]