From ripley at stats.ox.ac.uk  Wed Apr 27 19:21:43 2005
From: ripley at stats.ox.ac.uk (ripley@stats.ox.ac.uk)
Date: Wed Apr 27 19:21:52 2005
Subject: [Rd] as.data.frame: Error in "names<-.default" (PR#7808)
Message-ID: <20050427172143.D9140A1D3@slim.kubism.ku.dk>

On Sun, 24 Apr 2005 andy_liaw@merck.com wrote:

[...]

>> f <- function(x) deparse(substitute(x))
>> f(FUN(x1[1:3,,], x2=c("a","b"), x3=c("a", "b"), x4=c("a", "b")))
> [1] "FUN(x1[1:3, , ], x2 = c(\"a\", \"b\"), x3 = c(\"a\", \"b\"), x4 =
> c(\"a\", "
> [2] "    \"b\"))"
>
>
> which is caused by deparse() chopping up the expression.  The fix would be
> to set the width.cutoff argument to something large.  Here's a proposed
> patch:

[...]

> (I used width.cutoff=500, as ?deparse says that the max.  I'd imagine the
> number of characters allowed for valid symbol names in R is probably lower
> than that?)

This is an expression, and can be arbitrarily long.  So one needs to do 
things like terms.formula:

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

or just use the initial part (as done elsewhere).

It's fixed in R-patched now.

-- 
Brian D. Ripley,                  ripley@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


[Rd] as.data.frame: Error in "names<-.default" (PR#7808)
ripley@stats.ox.ac.uk