Unit conversions
Moderator:Jouni (see all) |
This page is a stub. You may improve it into a full page. |
Upload data
|
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.
Obs | From | To | Result | Description |
---|---|---|---|---|
1 | MWh | MJ | 3600 | 1 MWh = 1 MWh * 3600 s/h = 3600 MWs = 3600 MJ |
2 | toe | MJ | 35000 | 1 toe = 1000 kgoe = 1000 kg * 35 MJ/kg = 35000 MJ |
⇤--#: . 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)