Displaying 2 results from an estimated 2 matches for "n_asthma".
Did you mean:
asthma
2004 Dec 30
1
subsetting within a function
...LL){
subs <- with(mydata, eval(sub))
fit.glm <- glm(formula=formula, data=mydata, family=binomial, subset=subs)
return(fit.glm)
}
But when I tested it out with
test <- test.fun(y~x1+x2, mydata=testdata, sub=expression(SEX==0))
I get:
Error in "[.data.frame"(structure(list(N_ASTHMA = as.integer(c(0, 0, 0, :
invalid subscript type
I'm guessing that it's looking in the global environment for
subs, but I'm not sure
how to fix this. Any help would be greatly appreciated.
--
Pamela A McCaskie
BSc(Mathematical Sciences)(Hons)
Western Australian Institute for M...
2005 Jan 05
1
subsetting within a function using lme
..., data=mydata, family=binomial, subset=subs)
> > return(fit.glm)
> > }
> >
> > But when I tested it out with
> > test <- test.fun(y~x1+x2, mydata=testdata, sub=expression(SEX==0))
> >
> > I get:
> > Error in "[.data.frame"(structure(list(N_ASTHMA = as.integer(c(0, 0, 0, :
> > invalid subscript type
>
> I get a different error: it may be that you have an object called `subs`
> in the global environment
>
> > I'm guessing that it's looking in the global environment for
> > subs,
>
> More pre...