Difference between revisions of "Cradle through consumer BEA"

From Testiwiki
Jump to: navigation, search
(Dependencies: upload code)
m (Rationale)
 
(2 intermediate revisions by the same user not shown)
Line 8: Line 8:
 
== Answer ==
 
== Answer ==
  
 +
<rcode name="answer" embed=1>
 +
library(OpasnetUtils)
  
== Rationale ==
+
objects.latest("Op_en6286", code_name = "initiate") # [[Cradle through consumer BEA]]
  
<ref>Greg Norris: Personal communication 31 Jan 2014.</ref>
+
oprint(head(EvalOutput(BEA)@output))
  
=== Dependencies ===
+
</rcode>
  
This code is just temporary for uploading the data from an Excel to Opasnet Base.
+
== Rationale ==
<rcode variables="
 
name:dat|type:table|
 
name:subset|type:text|
 
name:unit|type:text
 
">
 
library(OpasnetUtils)
 
library(reshape2)
 
  
colnames(dat) <- t(dat[1,])
+
<ref>Greg Norris: Personal communication 31 Jan 2014. File name: \\cesium\jtue$\_Documents\Handprinter\CradleThroughConsumerBEA.xls </ref>
dat <- dat[2:nrow(dat) , ]
 
oprint(head(dat))
 
  
dat <- melt(dat, id.vars = 1, variable.name = 'Life cycle stage', value.name = 'Result')
+
=== Dependencies ===
  
oprint(head(dat))
+
[http://en.opasnet.org/en-opwiki/index.php?title=Cradle_through_consumer_BEA&oldid=31473 Code that was used to upload the data] on 5 Feb 2014. [http://en.opasnet.org/en-opwiki/index.php?title=Cradle_through_consumer_BEA&oldid=31477 Upload history]
  
opbase.upload(input = dat, ident = "Op_en6286", name = "Cradle through consumer BEA", subset = subset,
+
The data contains the following impacts:
obj_type = "variable", act_type = "replace", language = "eng", unit = unit, who = wiki_username)
+
* Climate change
 +
* Ecosystem quality
 +
* Human health
 +
* Resources
 +
* Water consumption
  
cat("Data uploaded successfully to Opasnet Base.\n")
+
In addition, there is one table with 430 product categories: Categories
</rcode>
 
  
 
=== Calculations ===
 
=== Calculations ===
Line 43: Line 39:
 
library(OpasnetUtils)
 
library(OpasnetUtils)
  
 +
categories <- opbase.data("Op_en6286", subset = "Categories")
 
climate <- opbase.data("Op_en6286", subset = "Climate change")
 
climate <- opbase.data("Op_en6286", subset = "Climate change")
 
ecosystem <- opbase.data("Op_en6286", subset = "Ecosystem quality")
 
ecosystem <- opbase.data("Op_en6286", subset = "Ecosystem quality")
Line 51: Line 48:
 
water$Result <- water$Result * 3.785411784 # From gallons to litres
 
water$Result <- water$Result * 3.785411784 # From gallons to litres
  
categories <- data.frame(climate[1:3]
+
levels(categories[["Category"]]) <- gsub("  ", "", levels(categories[["Category"]]))
levels(categories[["Category"]]) <- gsub("  ", "", levels(categories[["Category"]]))  
+
# One trailing space may stay but $ does not work in regular expression. Why?
# One training space may stay but $ does not work in regular expression. Why?
 
  
categories <- Ovariable("categories", data = categories, Result = 1))
+
categories <- Ovariable("categories", data = categories, Result = 1)
  
 
BEA <- rbind(
 
BEA <- rbind(
data.frame(Impact = "Climate change", Unit = "CO2eq /USD", climate[3:ncol(climate)]),
+
data.frame(Impact = "Climate change", Unit = "CO2eq /USD", climate),
 
data.frame(Impact = "Ecosystem quality", Unit = "PDF m2 /a /USD", ecosystem),
 
data.frame(Impact = "Ecosystem quality", Unit = "PDF m2 /a /USD", ecosystem),
 
data.frame(Impact = "Human health", Unit = "DALY /USD", health),
 
data.frame(Impact = "Human health", Unit = "DALY /USD", health),
Line 80: Line 76:
 
<references/>
 
<references/>
  
==Related files==<!-- __OBI_TS:1391436420 -->
+
==Related files==

Latest revision as of 10:33, 14 March 2014



Question

What are the life-cycle impacts of products from cradle to consumer?

Answer

+ Show code

Rationale

[1]

Dependencies

Code that was used to upload the data on 5 Feb 2014. Upload history

The data contains the following impacts:

  • Climate change
  • Ecosystem quality
  • Human health
  • Resources
  • Water consumption

In addition, there is one table with 430 product categories: Categories

Calculations

+ Show code

See also

Keywords

References

  1. Greg Norris: Personal communication 31 Jan 2014. File name: \\cesium\jtue$\_Documents\Handprinter\CradleThroughConsumerBEA.xls

Related files