[R] Re: Error in model.frame
Ross Boylan
ross at biostat.ucsf.edu
Sat Aug 16 01:15:41 CEST 2003
On Fri, 2003-08-15 at 16:03, Ross Boylan wrote:
> I am getting an error that I don't understand, and wonder if anyone
> could explain what's going on. I call a function defined thus:
>
> clogit.rds<-function(formula,data,extra.data,response.prob,
> na.action=getOption("na.action"),subset=NULL,
> control=coxph.control()){
> method="exact" # only option for now
> mf<-match.call()
> mf[[1]]<-as.name("model.frame")
> mf$method<-mf$control<-NULL
> mfn<-mf
>
> mfn$na.action<-"I"
> mfn$subset<-NULL
> nrows<-NROW(eval(mfn,parent.frame()))
> etc.
> At the eval on the last line, I get
>
> Error in model.frame(formula, rownames, variables, varnames, extras,
> extranames, :
> variable lengths differ
>
A clue: if I call this with response.prob set to an element of the
clogit.rds argument data frame, I don't get the error.
I assume that to fix this I must somehow exclude this variable. But I
will need it back in when I make the next call. Suggestions? Insights
into why this is necessary?
More information about the R-help
mailing list