Difference between revisions of "Mori/Codetest"
From Testiwiki
m |
|||
Line 25: | Line 25: | ||
{{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)}} | {{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)}} | ||
+ | |||
+ | ===="Selvemmät" printit==== | ||
+ | |||
+ | <rcode showcode = "1"> | ||
+ | library(xtable) | ||
+ | library(OpasnetUtils) | ||
+ | |||
+ | var1 <- data.frame(c = c("A", "A", "C"), d = c("D", "E", "E"), Result = 4:6) | ||
+ | cat("var1\n") | ||
+ | print(xtable(var1), type = "html") | ||
+ | |||
+ | var2 <- var1 | ||
+ | cat("var2\n") | ||
+ | print(xtable(var2), type = "html") | ||
+ | |||
+ | 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) | ||
+ | |||
+ | cat("Decision\n") | ||
+ | print(xtable(dec), type = "html") | ||
+ | |||
+ | out <- decisions.apply(dec) | ||
+ | |||
+ | cat("Variable", names(out)[1], "output\n") | ||
+ | print(xtable(out[[1]]), type = 'html') | ||
+ | |||
+ | cat("Variable", names(out)[2], "output\n") | ||
+ | print(xtable(out[[2]]), type = 'html') | ||
+ | |||
+ | </rcode> | ||
===New R-code=== | ===New R-code=== |
Revision as of 11:50, 28 June 2012
Old R-code
Test code
⇤# : 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. --Jouni 16:12, 16 May 2012 (EEST)
"Selvemmät" printit
library(xtable) library(OpasnetUtils) var1 <- data.frame(c = c("A", "A", "C"), d = c("D", "E", "E"), Result = 4:6) cat("var1\n") print(xtable(var1), type = "html") var2 <- var1 cat("var2\n") print(xtable(var2), type = "html") 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) cat("Decision\n") print(xtable(dec), type = "html") out <- decisions.apply(dec) cat("Variable", names(out)[1], "output\n") print(xtable(out[[1]]), type = 'html') cat("Variable", names(out)[2], "output\n") print(xtable(out[[2]]), type = 'html') |