Unit conversions

From Opasnet
Revision as of 09:29, 25 January 2012 by Jouni (talk | contribs) (placeholder)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Question

How to convert data from one unit to another in R?

Answer

We need conversion factors, which are listed below, and a code that does the actual conversion.

Unit conversions(-)
ObsFromToFactorDescription
1MWhMJ36001 MWh = 1 MWh * 3600 s/h = 3600 MWs = 3600 MJ
2toeMJ350001 toe = 1000 kgoe = 1000 kg * 35 MJ/kg = 35000 MJ

+ Show code

⇤--#: . The code does not work because the merges and combinations do not match. Values should have some row identifier that makes it possible to link a row in value to the right row in out. Should value and fromunit be two columns in a data.frame? --Jouni 11:29, 25 January 2012 (EET) (type: truth; paradigms: science: attack)