[R] Units of measurement

Frank E Harrell Jr fharrell at virginia.edu
Tue Nov 19 15:26:44 CET 2002


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
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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 mailing list