Skip to content

quickly extract response from formula

3 messages · William Dunlap, Andreas Leha

#
Hi David,

thanks for your quick answer!

David Winsemius <dwinsemius at comcast.net> writes:
This is what I'll be using.  Thanks again!

[...]

Regards,
Andreas
#
You can bullet-proof it a bit by making sure that length(formula)==3
before assuming that formula[[2]] is the response.   If length(formula)==2
then there is no response term, only predictor terms.  E.g., replace
   resp <- frm[[2]]
with
   resp <- if (length(frm)==3) frm[[2]] else NULL
(or call stop(), or warning(), ...)

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
#
William Dunlap <wdunlap at tibco.com> writes:
Will do.  Thanks.

- Andreas