[R] Logic regression equation in character form?

Thomas Lumley tlumley at u.washington.edu
Thu Feb 24 21:35:35 CET 2005


On Thu, 24 Feb 2005, Earl F. Glynn wrote:

> Why does this NOT work?
>> typeof(logicfit)
> [1] "list"
>> class(logicfit)
> [1] "logreg"
>> x <- paste(print(logicfit))
> score 0.968
> +2.14 * (((not X4) or ((not X13) and X19)) and (not X3)) -1.25 * ((((not
> X1) or (not X3)) and ((not X2) or X20)) and (((not X17) and X16) or ((not
> X20) and (not X1))))
>> x
> character(0)


It doesn't work because print() doesn't return the same thing that it 
prints. You need the output, not the return value.
You want capture.output().

 	-thomas




More information about the R-help mailing list