In many surveys, especially multinational ones that are based on paper forms,
it is common to enter continuous variables in one field with a categorical
variable for units of measurement (with 2 or 3 levels, usually) in the next
field. This is done to prevent conversion errors in the field. Conversions to
international standard units can take place just after data import or it can be
deferred until statistical computations are done. For the latter model an S
object which is a triple of (numeric measurement,factor variable containing
units for current subject,standard target units) would be easy to implement,
with an as.numeric( ) method or other conversion function to convert to
user-specified units (default=standard target units). A print method would
just print the units next to the value, with units varying across subjects.
There are several resources for units conversions such as the units program in
Linux/Unix (which comes with a database of linear and nonlinear units
conversions in ascii file units.dat) and several web sites. Has anyone
interfaced any general units conversion utilities to S?
Thanks in advance,
Frank
--
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
|