Mori/Codetest: Difference between revisions

From Opasnet
Jump to navigation Jump to search
No edit summary
mNo edit summary
 
(23 intermediate revisions by 4 users not shown)
Line 1: Line 1:
===Old R-code===
[[Category:Sandbox]]
 
'''Test code
 
<rcode>
library(xtable)
library(OpasnetUtils)
var1 <- data.frame(c = c("A", "A", "C"), d = c("D", "E", "E"), Result = 4:6)
var2 <- var1
dec <- data.frame(Decision = rep(c("Decision 1", "Decision 2"), each = 2), Option = c("OptA", "OptB"), Variable = c("var1", "var1", "var1", "var2"), Cell = c(" c: A; d: E", " d: D"), Change = c("Replace", "Multiply"), Result = 7:10)
var1
dec
out <- decisions.apply(dec)
cat("Variable", names(out)[1], "\n")
print(xtable(out[[1]]), type = 'html')
cat("Variable", names(out)[2], "\n")
print(xtable(out[[2]]), type = 'html')
 
data <- tidy(op_baseGetData("opasnet_base", "Op_en5466"), direction = "wide")
data <- data[colnames(data) != "Unit"]
data
data <- decisions.apply(data)
 
</rcode>
 
{{attack|# |Why does the var2 outcome show row 3 OptB A E 50, because the decision should be applied only for row 1 OptB A D 4 ? There is a bug somewhere. |--[[User:Jouni|Jouni]] 16:12, 16 May 2012 (EEST)}}
 
===New R-code===

Latest revision as of 11:31, 20 August 2014