[R] RW 0.64.2 substring() string truncation?

Prof Brian D Ripley ripley at stats.ox.ac.uk
Tue Aug 3 10:22:41 CEST 1999


On Tue, 3 Aug 1999, T.E.Diaz wrote:

> Can somebody tell me what exactly is going on below. Basically, I am 
> running into some kind of "string truncation" problem when I try 
> to get a substring starting past the 8192nd character (see sample 
> session below). There doesn't appear to be any problem creating the 
> string, and nchar() reports the correct size as constructed.

substr/substring has a buffer size limit of 8192. Indeed, the include file
says

Defn.h:#define MAXELTSIZE 8192 /* The largest string size */

One day this limit may be removed, but for now at least we could document
it.  I am not at all clear why one would want to use a single string longer
than 8192 chars: is it possible in your applications to use a vector of
shorter strings instead?

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list