Wacek Kusnierczyk
2009-Apr-21 10:23 UTC
[Rd] sprintf limits output string length with no warning/error message
sprintf has a limit on the length of a string produced with a '%s'
specification:
nchar(sprintf('%10000s', ''))
# 8191
nchar(sprintf('%*s', 10000, ''))
# 8191
This is sort of documented in ?sprintf:
" There is a limit of 8192 bytes on elements of 'fmt' and also on
strings included by a '%s' conversion specification."
but it should be a good idea for sprintf to at least warn when the
output is shorter than specified.
vQ