[rkward-cvs] SF.net SVN: rkward:[4217] branches/jss_dec_10

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon Apr 30 09:35:42 UTC 2012


Revision: 4217
          http://rkward.svn.sourceforge.net/rkward/?rev=4217&view=rev
Author:   tfry
Date:     2012-04-30 09:35:42 +0000 (Mon, 30 Apr 2012)
Log Message:
-----------
Prepare a clean directory for the polished final version.
In particular this contains directories and file name conventions as requested, and should contain no unneeded files (particularly figures) at the end.
So far, I only copied the example files. Will do the remainder, soon.

Added Paths:
-----------
    branches/jss_dec_10/final_polished/
    branches/jss_dec_10/final_polished/Code/
    branches/jss_dec_10/final_polished/Code/experiment.txt
    branches/jss_dec_10/final_polished/Code/plugin_demo/
    branches/jss_dec_10/final_polished/Code/plugin_demo/demo.pluginmap
    branches/jss_dec_10/final_polished/Code/plugin_demo/demo_t_test_two_vars.js
    branches/jss_dec_10/final_polished/Code/plugin_demo/demo_t_test_two_vars.rkh
    branches/jss_dec_10/final_polished/Code/plugin_demo/demo_t_test_two_vars.xml
    branches/jss_dec_10/final_polished/Code/v49i09.R
    branches/jss_dec_10/final_polished/Code/v49i09.txt
    branches/jss_dec_10/final_polished/Figures/

Copied: branches/jss_dec_10/final_polished/Code/experiment.txt (from rev 4215, branches/jss_dec_10/examples/experiment.txt)
===================================================================
--- branches/jss_dec_10/final_polished/Code/experiment.txt	                        (rev 0)
+++ branches/jss_dec_10/final_polished/Code/experiment.txt	2012-04-30 09:35:42 UTC (rev 4217)
@@ -0,0 +1,21 @@
+"before","after"
+"1",2.59881668817252,6.27938165864907
+"2",4.07322714105248,3.54498200886883
+"3",3.81693699024618,6.65626962389797
+"4",1.57162503339350,5.61035546311177
+"5",1.42704263795167,6.58266940689646
+"6",1.90141262393445,4.88719239784405
+"7",4.51673570461571,3.56738872313872
+"8",4.63976163044572,3.17273762961850
+"9",3.81835013255477,7.55779400654137
+"10",4.31393549032509,6.12445039628074
+"11",3.23106218222529,7.29057926521637
+"12",3.26707640662789,7.59672255907208
+"13",4.9570998288691,3.58348488877527
+"14",4.18278214335442,3.1944324770011
+"15",1.15126007888466,3.19534041988663
+"16",3.90166653227061,7.6175876702182
+"17",3.53701809793711,3.96727746771649
+"18",4.28850199189037,5.24918448948301
+"19",2.02426377404481,4.94558601593599
+"20",2.0060713943094,3.7008952985052

Copied: branches/jss_dec_10/final_polished/Code/plugin_demo/demo.pluginmap (from rev 4215, branches/jss_dec_10/examples/plugin_demo/demo.pluginmap)
===================================================================
--- branches/jss_dec_10/final_polished/Code/plugin_demo/demo.pluginmap	                        (rev 0)
+++ branches/jss_dec_10/final_polished/Code/plugin_demo/demo.pluginmap	2012-04-30 09:35:42 UTC (rev 4217)
@@ -0,0 +1,18 @@
+<!DOCTYPE rkpluginmap>
+
+<document base_prefix="" namespace="rkward">
+  <components>
+    <component type="standard" id="t_test_two_vars"
+          file="demo_t_test_two_vars.xml" label="Two Variable t-test" />
+  </components>
+
+  <hierarchy>
+    <menu id="analysis" label="Analysis" index="4">
+      <menu id="means" label="Means" index="4">
+        <menu id="ttests" label="t-Tests">
+          <entry component="t_test_two_vars" />
+        </menu>
+      </menu>
+    </menu>
+  </hierarchy>
+</document>

Copied: branches/jss_dec_10/final_polished/Code/plugin_demo/demo_t_test_two_vars.js (from rev 4215, branches/jss_dec_10/examples/plugin_demo/demo_t_test_two_vars.js)
===================================================================
--- branches/jss_dec_10/final_polished/Code/plugin_demo/demo_t_test_two_vars.js	                        (rev 0)
+++ branches/jss_dec_10/final_polished/Code/plugin_demo/demo_t_test_two_vars.js	2012-04-30 09:35:42 UTC (rev 4217)
@@ -0,0 +1,52 @@
+var x;
+var y;
+var varequal;
+var paired;
+
+function preprocess () {
+  x = getValue ("x");
+  y = getValue ("y");
+
+  echo ('names <- rk.get.description (' + x + ", " + y + ')\n');
+}
+
+function calculate () {
+  varequal = getValue ("varequal");
+  paired = getValue ("paired");
+
+  var conflevel = getValue ("conflevel");
+  var hypothesis = getValue ("hypothesis");
+
+  var options = ", alternative=\"" + hypothesis + "\"";
+  if (paired) options += ", paired=TRUE";
+  if ((!paired) && varequal) options += ", var.equal=TRUE";
+  if (conflevel != "0.95") options += ", conf.level=" + conflevel;
+
+  echo ('result <- t.test (' + x + ", " + y + options + ')\n');
+}
+
+function printout () {
+  echo ('rk.header (result\$method, \n');
+  echo ('  parameters=list ("Comparing", paste (names[1], "against", names[2]),\n');
+  echo ('  "H1", rk.describe.alternative (result)');
+  if (!paired) {
+    echo (',\n');
+    echo ('  "Equal variances", "');
+    if (!varequal) echo ("not");
+    echo (' assumed"');
+  }
+  echo ('))\n');
+  echo ('\n');
+  echo ('rk.results (list (\n');
+  echo ('  \'Variable Name\'=names,\n');
+  echo ('  \'estimated mean\'=result\$estimate,\n');
+  echo ('  \'degrees of freedom\'=result\$parameter,\n');
+  echo ('  t=result\$statistic,\n');
+  echo ('  p=result\$p.value');
+  if (getValue ("confint")) {
+    echo (',\n');
+    echo ('  \'confidence interval percent\'=(100 * attr(result\$conf.int, "conf.level")),\n');
+    echo ('  \'confidence interval of difference\'=result\$conf.int ');
+  }
+  echo ('))\n');
+}

Copied: branches/jss_dec_10/final_polished/Code/plugin_demo/demo_t_test_two_vars.rkh (from rev 4215, branches/jss_dec_10/examples/plugin_demo/demo_t_test_two_vars.rkh)
===================================================================
--- branches/jss_dec_10/final_polished/Code/plugin_demo/demo_t_test_two_vars.rkh	                        (rev 0)
+++ branches/jss_dec_10/final_polished/Code/plugin_demo/demo_t_test_two_vars.rkh	2012-04-30 09:35:42 UTC (rev 4217)
@@ -0,0 +1,28 @@
+<!DOCTYPE rkhelp>
+<document>
+	<summary>
+Two variable t-test (paired or independent samples).
+	</summary>
+
+	<usage>
+Chose two numeric vectors to compare against each other. Specify, whether the variables are paired or independent samples. For details, see below.
+	</usage>
+
+	<settings>
+		<caption id="tab_variables"/>
+		<setting id="x">A numeric vector for the first variable</setting>
+		<setting id="y">A numeric vector for the second variable</setting>
+		<setting id="hypothesis">Alternative hypothesis (H1) of the test.</setting>
+		<setting id="paired">Whether the variables are paired (repeated measurements on the same subject) or independent samples. For a paired test, if the two vectors are not of equal length, there will be an error.</setting>
+		<caption id="tab_options"/>
+		<setting id="varequal">Whether to assume equal variances for the two samples. This option is implied for a paired test.</setting>
+		<setting id="conflevel">Confidence level to use.</setting>
+		<setting id="confint">Whether to print the confidence interval of the estimated mean.</setting>
+	</settings>
+	<related>
+		<ul>
+			<li><link href="rkward://component/F_test"/></li>
+			<li><link href="rkward://rhelp/t.test"/></li>
+		</ul>
+	</related>
+</document>

Copied: branches/jss_dec_10/final_polished/Code/plugin_demo/demo_t_test_two_vars.xml (from rev 4215, branches/jss_dec_10/examples/plugin_demo/demo_t_test_two_vars.xml)
===================================================================
--- branches/jss_dec_10/final_polished/Code/plugin_demo/demo_t_test_two_vars.xml	                        (rev 0)
+++ branches/jss_dec_10/final_polished/Code/plugin_demo/demo_t_test_two_vars.xml	2012-04-30 09:35:42 UTC (rev 4217)
@@ -0,0 +1,42 @@
+<!DOCTYPE rkplugin>
+<document>
+  <code file="demo_t_test_two_vars.js"/>
+  <help file="demo_t_test_two_vars.rkh"/>
+
+  <logic>
+    <connect client="varequal.enabled" governor="paired.not"/>
+  </logic>
+
+  <dialog label="Two Variable t-Test">
+    <tabbook>
+      <tab label="Basic settings" id="tab_variables">
+        <row id="basic_settings_row">
+          <varselector id="vars"/>
+          <column>
+            <varslot type="numeric" id="x" source="vars" required="true"
+              label="compare"/>                                                             
+            <varslot type="numeric" id="y" source="vars" required="true"
+              label="against"/>
+            <radio id="hypothesis" label="using test hypothesis">
+              <option value="two.sided" label="Two-sided"/>
+              <option value="greater" label="First is greater"/>
+              <option value="less" label="Second is greater"/>
+            </radio>
+            <checkbox id="paired" label="Paired sample" value="1" value_unchecked="0" />
+          </column>
+        </row>
+      </tab>
+      <tab label="Options" id="tab_options">
+        <checkbox id="varequal" label="assume equal variances" value="1"
+          value_unchecked="0"/>
+        <frame label="Confidence Interval" id="confint_frame">
+          <spinbox type="real" id="conflevel" label="confidence level" min="0" max="1"
+            initial="0.95"/>
+          <checkbox id="confint" label="print confidence interval" value="1"
+            checked="true"/>
+        </frame>
+        <stretch/>
+      </tab>
+    </tabbook>
+  </dialog>
+</document>

Copied: branches/jss_dec_10/final_polished/Code/v49i09.R (from rev 4215, branches/jss_dec_10/examples/demo.R)
===================================================================
--- branches/jss_dec_10/final_polished/Code/v49i09.R	                        (rev 0)
+++ branches/jss_dec_10/final_polished/Code/v49i09.R	2012-04-30 09:35:42 UTC (rev 4217)
@@ -0,0 +1,133 @@
+## Instruction
+rk.show.message ("<b>Instructions</b><br>Most examples presented in the article are concerned with interactive GUI elements, which cannot be fully scripted in a 		meaningful way. For this reason, most demos will ask you to carry out certain user actions, such as pressing buttons, manually.<br><br>
+	In each case you will be given the
+	choice of taking ten (more) seconds to interact with the GUI, or to proceed to the next demo. <br><br><b>Note</b>: To be able to interact with the plugin windows, you must click on \"Give me 10 seconds\".")
+
+ok.to.proceed <- function (instruction) {
+	while (TRUE) {
+		res <- rk.show.question (instruction, "Ok to proceed?", "Give me 10 seconds to try", "Proceed to the next demo", "Quit demo.")
+		if (is.null (res)) stop ("Demo interrupted")
+		if (!isTRUE (res)) return ()
+		Sys.sleep (10)
+	}
+}
+
+
+## Figure 2
+my.data <- data.frame (var=numeric (1), var1=factor (1), var2=character (1), var3=logical (1), stringsAsFactors=FALSE)
+rk.sync.global ()
+
+f <- function () {
+      print ("Interactive console with syntax highlighting")
+   }
+   f ()
+setClass ("demoClass", representation=list (slotA="numeric", slotB="character", slotC="list"), contains="data.frame")
+s4.demo.object <- new ("demoClass")
+s4.demo.object at slotC <- list (a=1, b=2)
+
+ok.to.proceed ("<b>Replication of Figure 2</b>:<br>The object \"my.data\" has been created in the global environment.<br><br>
+Click on the \"Workspace\" button in the left tool view to show object information in the workspace browser.
+Click on the '+'-symbol next to the object to expand it.")
+
+
+ok.to.proceed ("<b>Replication of Figure 2</b>:<br>The object \"my.data\" has been created in the global environment.<br><br>
+Click on the \"Workspace\" button in the left tool view to show object information in the workspace browser.
+Click on the '+'-symbol next to the object to expand it.")
+
+## Figure 5
+library (datasets)
+data (CO2)
+data (DNase)
+data (ChickWeight)
+rk.sync.global ()
+rk.edit (CO2)
+rk.edit (ChickWeight)
+ok.to.proceed ("<b>Replication of Figure 5</b>:<br>Example data sets 'CO2' and 'ChickWeight' (from package datasets) have been opened for editing.<br>
+Use Windows->Detach from the menu to detach the editor showing the ChickWeight dataset.<br><br><b>Note</b>: The editors will <b>not</b> be populated with data, until the R interpreter becomes idle, i.e., in this case, until the demo script has finished.<br><br>
+After clicking 'Proceed', the command 'fix(DNase)' will be called. You will need to close the DNase dataset,
+manually, to proceed.")
+
+
+## Figure 6
+rk.call.plugin ("rkward::import_csv")
+ok.to.proceed ("<b>Replication of Figure 6</b>:<br>CSV data import dialog has been opened.<br>
+<b>Note</b>: You will have to close the dialog, manually, to get rid of it.</br>
+Click 'Proceed' when done interacting.")
+
+
+## Figure 7
+graphics.off ()
+rk.clear.plot.history ()
+plot (rnorm (50))
+data_rnorm <- rnorm (50)
+boxplot (data_rnorm)
+plot (ecdf (data_rnorm))
+hist (data_rnorm)
+stripchart (data_rnorm)
+rk.first.plot ()
+ok.to.proceed ("<b>Replication of Figure 7</b>:<br>Five plots have been created, and the first has been activated.</br>
+Click on the 'Go to plot' toolbar icon for a drop-down list of plots.")
+
+
+## Figure 8
+rk.call.plugin ("rkward::descriptive", constMad.real="1.4628", length.state="1", mad.state="0", mad_type.string="average", mean.state="1", median.state="1", prod.state="0", range.state="1", sd.state="1", sum.state="0", trim.real="0.00", x.available="DNase[[\"density\"]]\nDNase[[\"conc\"]]\nChickWeight[[\"weight\"]]\nChickWeight[[\"Time\"]]", submit.mode="submit")
+rk.header ("A custom heading")
+ok.to.proceed ("<b>Replication of Figure 8, upper portion</b>:<br>The result of running the 'Descriptive Statistics' plugin, and the
+text 'A custom heading' should now be visible in the output window. If it is not visible, use Windows->Show Output from the menu.")
+
+f <- function () {
+    # The only purpose of this function is to illustrate the documentation of
+    # custom R code and the corresponding R output in the RKWard output window
+    print ("A piece of output")
+}
+f ()
+ok.to.proceed ("<b>Replication of Figure 8, lower portion</b>:<br>This part of the figure can only be reproduced by interacting with the GUI, manually:<br>Run->CC commands to ouptut... from the menu, and enable copying of commands entered in the console. Then, paste the code snippet to the console.")
+
+## Figure 9
+rk.call.plugin ("rkward::import_csv", quick.string="csv", name.objectname="experiment.data", file.selection=paste (getwd (), "experiment.txt", sep="/"))
+ok.to.proceed ("<b>Replication of Figure 9</b>:<br>CSV data import dialog.</br><br><br>
+<b>Note</b>: You may need to adjust the path to the file 'experiment.txt', which we provided in the same directory
+as the demo script.<br><br>
+Click 'Submit' when done. Subsequent demos require this data, so <b>do</b> click 'Submit' before proceeding.")
+
+
+## Figure 10
+rk.call.plugin ("rkward::t_test_two_vars", confint.state="1", conflevel.real="0.95", hypothesis.string="less", paired.state="1", x.available="experiment.data[[\"before\"]]", y.available="experiment.data[[\"after\"]]", submit.mode="manual")
+ok.to.proceed ("<b>Replication of Figure 10</b>:<br>Dialog for t-test on imported data.</br><br><br>
+<b>Note</b>: The results (Figure 10B) will appear in the output window after clicking 'Submit'.")
+
+
+## Figure 11
+rk.call.plugin ("rkward::box_plot", mean.state="", names_custom.text="T1;T2", names_exp.text="names (x)", names_mode.string="custom", notch.state="FALSE", orientation.string="FALSE", outline.state="TRUE", plotoptions.add_grid.state="0", plotoptions.asp.real="0.00", plotoptions.main.text="", plotoptions.pointcolor.color.string="", plotoptions.pointtype.string="", plotoptions.sub.text="", plotoptions.xaxt.state="", plotoptions.xlab.text="", plotoptions.xlog.state="", plotoptions.xmaxvalue.text="", plotoptions.xminvalue.text="", plotoptions.yaxt.state="", plotoptions.ylab.text="", plotoptions.ylog.state="", plotoptions.ymaxvalue.text="", plotoptions.yminvalue.text="", sd.state="", x.available="experiment.data[[\"before\"]]\nexperiment.data[[\"after\"]]", submit.mode="manual")
+ok.to.proceed ("<b>Replication of Figure 11</b>:<br>Dialog for boxplot of imported data.</br><br><br>
+<b>Note</b>: To follow the text of the article, you can check the 'Preview'-box, here, but this is not required for this demo. Click 'Close' when done.")
+
+
+## Figure 12
+data_list <- experiment.data
+names (data_list) <- c ("T1", "T2")
+boxplot (data_list, notch = FALSE, outline = TRUE, horizontal = FALSE)
+ok.to.proceed ("<b>Replication of Figure 12</b>:<br>Box plot of imported data.</br><br><br>
+Select Device->Export... to bring up the dialog shown in Figure 12 (not accessible programmatically).")
+
+
+## Section 5.2
+rk.show.message ("<b>Code listing in Section 5.2</b>.<br>The following demo runs the code listing in section 5.2
+of the article.<br><br>First, we run the example that <b>is</b> subject to object modification detection.
+On typical systems, this will take several seconds to complete.")
+i <- 1
+rk.sync.global ()	# Needed to trigger object modification detection without returning to the toplevel command prompt
+for (i in 1:100000) i+i
+rk.show.message ("<b>Code listing in Section 5.2</b>.<br>Next, we run the example that <b>is not</b> subject to object modification detection, but performs equivalent computations. This should finish nearly instantaneously.")
+f <- function () {
+	i <- 1
+	for (i in 1:100000) i+i
+}
+f ()
+
+
+## Done
+rk.show.message ("<b>Finished</b>.<br>This concludes the demo.<br><br>
+<b>Note</b> that the example plugin shown in section 6 cannot be wrapped into this demo script in a meaningful
+way. For instructions on replicating this example, see the \'README.txt\' file which we provided in the same directory
+as this demo script.")

Copied: branches/jss_dec_10/final_polished/Code/v49i09.txt (from rev 4215, branches/jss_dec_10/examples/README.txt)
===================================================================
--- branches/jss_dec_10/final_polished/Code/v49i09.txt	                        (rev 0)
+++ branches/jss_dec_10/final_polished/Code/v49i09.txt	2012-04-30 09:35:42 UTC (rev 4217)
@@ -0,0 +1,25 @@
+-- Requirements for this demonstration --
+These demonstration files require an existing installation of RKWard 0.5.4 (or later) on your
+system. Please refer to http://rkward.sf.net for instructions on the various
+methods of installation.
+
+-- Replicating examples and figures from Sections 3, 4, and 5 --
+To replicate the examples and figures from Sections 3, 4, and 5 of the article,
+source or paste the script 'v49i09.R' contained in the same directory as this file,
+*inside an RKWard session*. Assuming that the rkward binary is in your system's
+search path, you can also run
+   rkward --evaluate "source ('v49i09.R')"
+from within the directory containing this file.
+
+Note that since most examples/figures are concerned with interactive GUI
+elements, the demonstration script runs interactively as well, and will prompt
+you to perform certain user actions, which cannot (meaningfully) be scripted.
+
+-- Plugin example from Section 6 --
+Section 6 of the article shows how to extend RKWard by a custom plugin. The
+required files are included in the sub-directory 'plugin_demo' contained in the
+same directory as this file. To activate these, start an RKWard session, and select
+Settings->Configure RKWard->Plugins from the menu. Add the file
+plugin_demo/demo.pluginmap to the list of .pluginmap files.
+
+Note that the official RKWard distribution already contains a t-test plugin.

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the rkward-tracker mailing list