[Rd] Problem with pasteing formulas (PR#8897)

ripley at stats.ox.ac.uk ripley at stats.ox.ac.uk
Wed May 24 15:29:42 CEST 2006


See ?as.character (which paste effectively calls on non-character objects, 
as ?paste says):

Note:

      'as.character' truncates components of language objects to 500
      characters (was about 70 before 1.3.1).

so it is working as documented.  Not then a bug.

You can (and probably should) use a construct like that in terms.formula:

         else paste(deparse(form[[2]]), collapse = "")

to convert a formula to a complete character string.


On Wed, 24 May 2006, john.little at dunelm.org.uk wrote:

> Hi,
> If I create a formula with say 100 terms and then paste it:
>
> xnam <- paste("x", 1:100, sep="")
> fmla <- as.formula(paste("y ~ ", paste(xnam, collapse= "+")))
> paste(fmla)
>
> The result seems to cut off everything after the first 500 characters
> and gives no warning message.
>
> I have the most recent version of R from the R website and the problem
> occurs on both Unix and Windows machines
>
> Thanks
>
> John
>

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-devel mailing list