How do you extend factor() without abstract data types?

The idea is to have
        factor (x, TYPE)
to transform all or selected components of x to factor TYPE.
Value:
a data structure of same type as x, with factor-like components transformed to be like TYPE.

In the Pascal family, you would define an abstract data type. In R, the best seems to be to provide a prototype example.

This should be fail-save, and maybe a candidate to extend the base factor() function.

A draft that can handle a very limited range of cases is in
        <http:///sintro.r-forge.r-project.org/sprof/asfactormodel.R>
and documented in
        <http:///sintro.r-forge.r-project.org/sprof/sprof_internal.pdf>.

Comments and recommendations are welcome.
 gs.

--
G. Sawitzki
StatLab Heidelberg
Im Neuenheimer Feld 294
D 69120 Heidelberg
Tel. (+49) 62 21 - 54 89 79   Fax (+49) 62 21 - 54 53 31
    <http://www.statlab.uni-heidelberg.de/users/gs/>

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to