Skip to content
Prev 12630 / 398502 Next

[S] Labels wrong with lrm

Dear Thomas,

Your code solves the problem.  Thank you!

To users of the Design library such as Jan Brogger
who want to be able to
use variables as the second argument to one of the
library's transformation functions (pol, rcs, lsp),
you can redefine the var.inner function in the Hmisc
library as the following until the fix is made on the
source code posted on our web page.

var.inner <- function(formula) {
  if(!inherits(formula,"formula")) formula <- attr(formula,"formula")
  if(!length(formula)) stop('no formula object found')
	if(length(formula) > 2)
		formula[[2]] <- NULL  # remove response variable
  av <- all.vars(formula)
  ## Thanks to Thomas Lumley <tlumley at u.washington.edu> 28Jul01 :
  unique(sapply(attr(terms(formula),"term.labels"),
         function(term,av)
	av[match(all.vars(parse(text=term)),av)][1],
                av=av) )
}
 
-Frank Harrell
Thomas Lumley wrote: