[rkward-cvs] SF.net SVN: rkward-code:[4812] trunk/rkward/rkward/plugins

tfry at users.sf.net tfry at users.sf.net
Thu Sep 11 18:40:36 UTC 2014


Revision: 4812
          http://sourceforge.net/p/rkward/code/4812
Author:   tfry
Date:     2014-09-11 18:40:36 +0000 (Thu, 11 Sep 2014)
Log Message:
-----------
Start sketching factor recoding plugin. Very much unfinished.

Modified Paths:
--------------
    trunk/rkward/rkward/plugins/data/level_select.xml
    trunk/rkward/rkward/plugins/under_development.pluginmap

Added Paths:
-----------
    trunk/rkward/rkward/plugins/data/recode_categorical.js
    trunk/rkward/rkward/plugins/data/recode_categorical.rkh
    trunk/rkward/rkward/plugins/data/recode_categorical.xml

Modified: trunk/rkward/rkward/plugins/data/level_select.xml
===================================================================
--- trunk/rkward/rkward/plugins/data/level_select.xml	2014-09-07 16:36:02 UTC (rev 4811)
+++ trunk/rkward/rkward/plugins/data/level_select.xml	2014-09-11 18:40:36 UTC (rev 4812)
@@ -1,14 +1,18 @@
 <!DOCTYPE rkplugin>
 <document>
 	<code file="level_select.js" />
-	<help file="level_select.rkh" />
 	<logic>
+		<!-- This plugin is meant for embedding only. Provides a <valueselector> holding levels of a variable
+			(or other info queried from R).
+			External properties:
+				- variable: Connect this to the variable to fetch levels for (typically the available-property of a varslot)
+				- limit: Optionally adjust max number of levels to fetch. Default is 100.
+				- custom_expression: A custom expression to run instead of levels(_X_). The string '_X_' is replaced with the variable name.
+		-->
 		<external id="variable" default=""/>
 		<external id="custom_expression" default=""/>
 		<external id="limit" default="100"/>
 
-		<connect client="variable" governor="x.available"/>
-
 		<script><![CDATA[
 				last_command_id = -1;
 				gui.setValue ("limitnote.visible", false);
@@ -49,11 +53,6 @@
 		]]></script>
 	</logic>
 	<dialog label="Level selector">
-		<row>
-			<varselector id="vars"/>
-			<varslot id="x" source="vars"/>
-		</row>
-		
 		<valueselector id="selector" />
 		<text id="limitnote" type="warning">
 			Note: Some values were cut off.

Added: trunk/rkward/rkward/plugins/data/recode_categorical.js
===================================================================
Added: trunk/rkward/rkward/plugins/data/recode_categorical.rkh
===================================================================
Added: trunk/rkward/rkward/plugins/data/recode_categorical.xml
===================================================================
--- trunk/rkward/rkward/plugins/data/recode_categorical.xml	                        (rev 0)
+++ trunk/rkward/rkward/plugins/data/recode_categorical.xml	2014-09-11 18:40:36 UTC (rev 4812)
@@ -0,0 +1,46 @@
+<!DOCTYPE rkplugin>
+<document>
+	<code file="recode_categorical.js" />
+	<help file="recode_categorical.rkh" />
+	<logic>
+		<connect governor="x.available" client="levels.variable"/>
+	</logic>
+	<dialog label="Recode categorical data"><tabbook>
+		<tab label="Input and output variables">
+				<varselector id="vars"/>
+				<varslot id="x" source="vars" label="Select variable to recode"/>
+			<text>TODO where to store output</text>
+			<dropdown id="datamode" label="Data type after recoding">
+				<option value="character" label="Character"/>
+				<option value="factor" label="Factor" checked="true"/>
+				<option value="numeric" label="Numeric"/>
+				<option value="logical" label="Logical"/>
+			</dropdown>
+		</tab>
+		<tab label="Values">
+			<row>
+				<embed id="levels" component="rkward::level_select"/>
+				<column>
+					<optionset id="set" min_rows="1">
+						<content>
+							<frame>
+								<optiondisplay index="true"/>
+								<valueslot multi="true" min_vars="1" id="values" label="Values to recode"/>
+								<input id="other_custom" label="Value"/>
+							</frame>
+						</content>
+					</optionset>
+
+					<radio id="other" label="Any other values">	<!-- TODO Should this be including original NAs? -->
+						<option value="copy" label="Copy" id="copy_others"/>
+						<option value="na" label="NA"/>
+						<option value="custom" label="Custom value:"/>
+					</radio>
+					<input id="other_custom" label="Value"/>
+
+					<checkbox id="drop" label="Drop NAs in recoded variable"/>
+				</column>
+			</row>
+		</tab>
+	</tabbook></dialog>
+</document>
\ No newline at end of file

Modified: trunk/rkward/rkward/plugins/under_development.pluginmap
===================================================================
--- trunk/rkward/rkward/plugins/under_development.pluginmap	2014-09-07 16:36:02 UTC (rev 4811)
+++ trunk/rkward/rkward/plugins/under_development.pluginmap	2014-09-11 18:40:36 UTC (rev 4812)
@@ -14,9 +14,10 @@
 		<component type="standard" id="optionset_test" file="testing/optionset.xml" label="Optionset Test" />
 		<component type="standard" id="matrix_test1" file="testing/matrix1.xml" label="Input Matrix Test" />
 		<component type="standard" id="valueselect_test1" file="testing/valueselect1.xml" label="Valueselector/valueslot/select Test" />
+<!-- End -->
 
+		<component type="standard" id="recode_categorical" file="data/recode_categorical.xml" label="Recode categorical data" />
 		<component type="standard" id="level_select" file="data/level_select.xml" label="Select by value" />
-<!-- End -->
 
 		<component type="standard" id="import_xls" file="00saveload/import/import_xls.xml" label="Import MS EXCEL">
 			<attribute id="format" value="*.xls *.xlsx" label="MS EXCEL sheet"/>
@@ -37,6 +38,7 @@
 			<entry component="generate_random"/>
 			<entry component="sort_data"/>
 			<entry component="sort_data2"/>
+			<entry component="recode_categorical"/>
 		</menu>
 		<menu id="analysis" label="Analysis" index="4">
 			<entry component="simple_anova" index="9"/>
@@ -44,7 +46,6 @@
 			<entry component="optionset_test" index="1"/>
 			<entry component="matrix_test1" index="1"/>
 			<entry component="valueselect_test1" index="1"/>
-			<entry component="level_select" index="1"/>
 		</menu>
 		<menu id="plots" label="Plots" index="5">
 			<entry component="sieve_plot" />





More information about the rkward-tracker mailing list