Question: I am trying to impliment a function in R that we use quite regularly in Splus, and it fails due to a lack of the "terms.inner" function in R. The substitute is? Part question and part soapbox: Why remove terms.inner from R? It's little used, but rather innocuous. Mostly soapbox: I figured it was no big deal, as I originally discovered the use of terms.inner from reading the plot.gam function. So I'd just see what plot.gam does in R. > plot.gam Error: object "plot.gam" not found Ok, I know this function has to exist. I even remember that there is some sort of multi-colon secret handshake that will convince R to let you look at it, although I don't remember the form. This Nixonesque passion with hiding things is one of the reasons I still prefer Splus. Terry Therneau therneau.terry at mayo.edu
On Tue, Sep 05, 2006 at 08:24:54AM -0500, Terry Therneau wrote: ... ... <Terry> > plot.gam <Terry> Error: object "plot.gam" not found if I do library(gam) plot.gam it prints the function <Terry> <Terry> Ok, I know this function has to exist. I even remember that there is some <Terry>sort of multi-colon secret handshake that will convince R to let you look <Terry>at it, although I don't remember the form. This Nixonesque passion with <Terry>hiding things is one of the reasons I still prefer Splus. afaik getAnywhere(function name) usually works for the hidden ones...though I don't quite understand why one should hide them HIH, Stefano <Terry> <Terry> <Terry> Terry Therneau <Terry> therneau.terry a mayo.edu <Terry> <Terry>______________________________________________ <Terry>R-help a stat.math.ethz.ch mailing list <Terry>https://stat.ethz.ch/mailman/listinfo/r-help <Terry>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html <Terry>and provide commented, minimal, self-contained, reproducible code.
Check out: http://tolstoy.newcastle.edu.au/R/help/01c/0340.html On 9/5/06, Terry Therneau <therneau at mayo.edu> wrote:> Question: > I am trying to impliment a function in R that we use quite regularly in > Splus, and it fails due to a lack of the "terms.inner" function in R. > The substitute is? > > Part question and part soapbox: > Why remove terms.inner from R? It's little used, but rather innocuous. > > Mostly soapbox: > I figured it was no big deal, as I originally discovered the use of > terms.inner from reading the plot.gam function. So I'd just see what > plot.gam does in R. > > plot.gam > Error: object "plot.gam" not found > > Ok, I know this function has to exist. I even remember that there is some > sort of multi-colon secret handshake that will convince R to let you look > at it, although I don't remember the form. This Nixonesque passion with > hiding things is one of the reasons I still prefer Splus. > > > Terry Therneau > therneau.terry at mayo.edu > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
On Tue, 5 Sep 2006, Terry Therneau wrote:> Question: > I am trying to impliment a function in R that we use quite regularly in > Splus, and it fails due to a lack of the "terms.inner" function in R. > The substitute is? > > Part question and part soapbox: > Why remove terms.inner from R? It's little used, but rather innocuous.AFAIK it wasn't removed, it just hasn't ever been implemented. Probably no-one in the early years of R tried to port any code that used it -- there were a number of functions added back then just because the survival package used them, such as subscripting on terms objects.> Mostly soapbox: > I figured it was no big deal, as I originally discovered the use of > terms.inner from reading the plot.gam function. So I'd just see what > plot.gam does in R. > > plot.gam > Error: object "plot.gam" not found > > Ok, I know this function has to exist. I even remember that there is some > sort of multi-colon secret handshake that will convince R to let you look > at it, although I don't remember the form. This Nixonesque passion with > hiding things is one of the reasons I still prefer Splus.Perhaps not the best soapbox example. There are at least two gam implementations, but they are both in add-on packages. Neither of them hides its plot.gam in a namespace, but you do need to install and load the package. You presumably want Trevor Hastie's one, which is in the "gam" package, rather than Simon Woods' one in the "mgcv" package. BTW, termplot() does many of the same things as Hastie's plot.gam(). It is also not hidden. If I understand correctly what terms.inner does, termplot() uses two functions: pf <- envir carrier <- function(term) { if (length(term) > 1) carrier(term[[2]]) else eval(term, data, enclos = pf) } carrier.name <- function(term) { if (length(term) > 1) carrier.name(term[[2]]) else as.character(term) } to do the job. -thomas Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle