Mori/Codetest: Difference between revisions

From Opasnet
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:
===Rcode===
===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 include="page:Mori/Codetest|name:answer">
<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.applyx(dec)
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.applyx(data)
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===

Revision as of 08:41, 28 June 2012

Old R-code

+ Show code


Test code

+ Show 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) (type: truth; paradigms: science: attack)

New R-code