Full_Name: simon wood Version: 2.2.0 (and lower) OS: linux/windows Submission from: (NULL) (86.135.153.59) I think that the documentation for the `specials' attribute of a `terms.object' is not quite right: specials: If the 'specials' argument was given to 'terms.formula' there is a 'specials' attribute, a list of vectors indicating the terms that contain these special functions. should read something like: specials: If the 'specials' argument was given to 'terms.formula' there is a 'specials' attribute, a list of vectors indicating the variables that contain these special functions. Here is some example code illustrating the problem: tf <- terms.formula(y~x+x:z+s(x),specials="s") ## make a `terms' object attr(tf,"specials") ## documented to index `s' in list of terms ## but in lists of terms, `s' is in position 2, not 4 .... attr(tf,"term.labels") colnames(attr(tf,"factors")) ## in lists of variables `s' *is* in position 4... attr(tf,"variables") rownames(attr(tf,"factors")) best, Simon
ripley@stats.ox.ac.uk
2005-Nov-28 18:55 UTC
[Rd] terms.object documentation bug? (PR#8353)
On Mon, 28 Nov 2005 s.wood at bath.ac.uk wrote:> Full_Name: simon wood > Version: 2.2.0 (and lower) > OS: linux/windows > Submission from: (NULL) (86.135.153.59) > > > I think that the documentation for the `specials' attribute of a `terms.object' > is not quite right: > > specials: If the 'specials' argument was given to 'terms.formula' there > is a 'specials' attribute, a list of vectors indicating the > terms that contain these special functions.This is wrong, but it does not say `in the list of terms'.> should read something like: > > specials: If the 'specials' argument was given to 'terms.formula' there > is a 'specials' attribute, a list of vectors indicating the > variables that contain these special functions.You are right it refers to the variables, but we need to make clear that the vectors are numeric indices, and into what (not the variables attribute).> Here is some example code illustrating the problem: > > tf <- terms.formula(y~x+x:z+s(x),specials="s") ## make a `terms' object > attr(tf,"specials") ## documented to index `s' in list of terms > ## but in lists of terms, `s' is in position 2, not 4 .... > attr(tf,"term.labels") > colnames(attr(tf,"factors")) > > ## in lists of variables `s' *is* in position 4... > attr(tf,"variables") > rownames(attr(tf,"factors"))Thanks, I have adapted that for the help page. -- 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