[R] Ordered factors and DBMS
Frank E Harrell Jr
fharrell at virginia.edu
Thu Oct 4 21:18:58 CEST 2001
As someone mentioned in a previous posting, the inherent ENUM and
SET data types in MySQL give it an advantage in this area.
I am just starting to work on a project in which XML
Metadata specifies a MySQL database (including factor
levels for ENUM and SET (multiple choice instead of single)
fields). This metadata will later drive some "smart"
import functions in R that will make such variables
immediately analyzable and self-documenting. Some
mocked-up examples are at the end of the slides from
a talk I recently gave, available at
I prefer to use the inherent data types rather than
making factor labels reside in a separate SQL table.
I have only just begun to look at RMySQL documentation.
Does RMySQL fetch SET variables as binary integers
such that selected choices can be sensed once
the bit mapping is known?
Jason Turner wrote:
> Additions to Doug Bates' suggestions
> > ... it could be expressed naturally as two tables and a
> > join. The first table would contain the data as factor levels and the
> > second table would give the correspondence between levels and labels.
> I think this is probably the most clear and elegant way to do it.
> > Another possibility is to define a PostgreSQL data type for this.
> See the PosgreSQL documentation for "CREATE TYPE".
> Indigo Industrial Controls Ltd.
> jasont at indigoindustrial.co.nz
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
Frank E Harrell Jr Prof. of Biostatistics & Statistics
Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences
U. Virginia School of Medicine http://hesweb1.med.virginia.edu/biostat
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help