Mori/Codetest: Difference between revisions
Jump to navigation
Jump to search
(Created page with "===Rcode=== <rcode name="answer" label="Initialise functions" include="page:OpasnetBaseUtils|name:generic"> ############### decisions.applyx takes a decision table and applies ...") |
mNo edit summary |
||
Line 1: | Line 1: | ||
=== | ===Old R-code=== | ||
<rcode name="answer" label="Initialise functions" include="page:OpasnetBaseUtils|name:generic"> | <rcode name="answer" label="Initialise functions" include="page:OpasnetBaseUtils|name:generic"> | ||
Line 60: | Line 60: | ||
'''Test code | '''Test code | ||
<rcode | <rcode> | ||
library(xtable) | library(xtable) | ||
var1 <- data.frame(c = c("A", "A", "C"), d = c("D", "E", "E"), Result = 4:6) | var1 <- data.frame(c = c("A", "A", "C"), d = c("D", "E", "E"), Result = 4:6) | ||
Line 67: | Line 67: | ||
var1 | var1 | ||
dec | dec | ||
out <- decisions. | out <- decisions.apply(dec) | ||
cat("Variable", names(out)[1], "\n") | cat("Variable", names(out)[1], "\n") | ||
print(xtable(out[[1]]), type = 'html') | print(xtable(out[[1]]), type = 'html') | ||
Line 77: | Line 77: | ||
data <- data[colnames(data) != "Unit"] | data <- data[colnames(data) != "Unit"] | ||
data | data | ||
data <- decisions. | data <- decisions.apply(data) | ||
</rcode> | </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)}} | {{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=== |