[rkward] rkward/plugins/rkwarddev_scripts: started replacing some ite() calls with js(if())

m.eik michalke meik.michalke at uni-duesseldorf.de
Thu Nov 26 23:16:20 UTC 2015


Git commit 6aca03fecae3286c89544d6fdc9d4513caa8be3b by m.eik michalke.
Committed on 26/11/2015 at 19:48.
Pushed by meikm into branch 'master'.

started replacing some ite() calls with js(if())

  - this will still fail to build with stable rkwarddev releases, but the new release will be out shortly before the next RKWard release

M  +33   -37   rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R

http://commits.kde.org/rkward/6aca03fecae3286c89544d6fdc9d4513caa8be3b

diff --git a/rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R b/rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R
index e43d43e..7198463 100644
--- a/rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R
+++ b/rkward/plugins/rkwarddev_scripts/rkwarddev_power_plugin_script.R
@@ -307,47 +307,43 @@ pwr.js.calc <- rk.paste.JS(
   echo("\tpwr.result <- try(\n\t\t"),
   #########
   ## t-test
-  ite(id(pwr.stat.drop, " == \"pwr.t.test\""),
-    rk.paste.JS(
+  js(
+    if(pwr.stat.drop == "pwr.t.test"){
       # two samples with different sizes or not?
-      ite(id(pwr.type.drop, " == \"two.sample.diff\""),
-        rk.paste.JS(# yes
-          echo("pwr.t2n.test("),
-          ite(id(pwr.parameter.rad, " != \"Sample size\""),
-            echo("\n\t\t\tn1=", pwr.input.sample.n1, ",\n\t\t\tn2=", pwr.input.sample.n2),
-            echo("\n\t\t\tn1=", pwr.input.sample.n1, ",")
-          )
-        ),
-        rk.paste.JS(#no
-          echo("pwr.t.test("),
-          ite(id(pwr.parameter.rad, " != \"Sample size\""),
-            echo("\n\t\t\tn=", pwr.input.sample)
-          )
-        )
-      ),
-      ite(id(pwr.parameter.rad, " != \"Effect size\""),
-        rk.paste.JS(
-          ite(id(pwr.parameter.rad, " != \"Sample size\""), echo(",")),
-          echo("\n\t\t\td=", pwr.input.effect)
-        )
-      )
-    )
-  ),
+      if(pwr.type.drop == "two.sample.diff"){
+        echo("pwr.t2n.test(")
+        if(pwr.parameter.rad != "Sample size"){
+          echo("\n\t\t\tn1=", pwr.input.sample.n1, ",\n\t\t\tn2=", pwr.input.sample.n2)
+        } else {
+          echo("\n\t\t\tn1=", pwr.input.sample.n1, ",")
+        }
+      } else {
+        echo("pwr.t.test(")
+        if(pwr.parameter.rad != "Sample size"){
+          echo("\n\t\t\tn=", pwr.input.sample)
+        } else {}
+      }
+      if(pwr.parameter.rad != "Effect size"){
+        if(pwr.parameter.rad != "Sample size"){
+          echo(",")
+        } else {}
+        echo("\n\t\t\td=", pwr.input.effect)
+      } else {}
+    } else {},
   ###############
   ## correlations
-  ite(id(pwr.stat.drop, " == \"pwr.r.test\""),
-    rk.paste.JS(
-      echo("pwr.r.test("),
-      ite(id(pwr.parameter.rad, " != \"Sample size\""),
+    if(pwr.stat.drop == "pwr.r.test"){
+      echo("pwr.r.test(")
+      if(pwr.parameter.rad != "Sample size"){
         echo("\n\t\t\tn=", pwr.input.sample)
-      ),
-      ite(id(pwr.parameter.rad, " != \"Effect size\""),
-        rk.paste.JS(
-          ite(id(pwr.parameter.rad, " != \"Sample size\""), echo(",")),
-          echo("\n\t\t\tr=", pwr.input.effect)
-        )
-      )
-    )
+      } else {}
+      if(pwr.parameter.rad != "Effect size"){
+        if(pwr.parameter.rad != "Sample size"){
+          echo(",")
+        } else {}
+        echo("\n\t\t\tr=", pwr.input.effect)
+      } else {}
+    } else {}
   ),
   ########
   ## ANOVA



More information about the rkward-tracker mailing list