[R] factor() without abstract types

G. Sawitzki gs at statlab.uni-heidelberg.de
Mon Aug 26 20:13:15 CEST 2013


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/>



More information about the R-help mailing list