Dear developers,

I just discovered rkward and am very impressed.  I mostly write
scripts but have used R Commander with students and look forward to
suggesting rkward as well.

I have used the import_spss template to write an import_stata module.
 I changed the various options and flags from the read.spss() command
to the read.dta() options.  So far it is working for me, although it
is possible that the code could be cleaned up.  I'd be grateful for
feedback or suggestions and will make changes that are within my
limited programming capability.  If the code is ok, maybe it can be
included in the next release.

Best regards,
Michael

-- 
Michael Ash, Associate Professor
  of Economics and Public Policy
Department of Economics and CPPA
University of Massachusetts
Amherst, MA 01003
Tel +1-413-545-6329 Fax +1-413-545-2921
Email m...@econs.umass.edu
http://people.umass.edu/maash

<<attachment: import_stata.php>>

Attachment: import_stata.rkh
Description: Binary data

<!DOCTYPE rkplugin>
<document>
	<code file="import_stata.php" />
	<help file="import_stata.rkh" />
	<logic>
		<external id="filename"/>
		<connect governor="filename" client="file.selection"/>
		
		<connect governor="data_frame.state" client="doedit.enabled" />
		
		<connect governor="use_labels.state" client="labels_limit.enabled"/>
		<connect governor="use_labels.state" client="trim_labels.enabled"/>
		
		<connect governor="do_locale_conversion.state" client="encoding.enabled" />
		<convert id="other_encoding" mode="equals" standard="other" sources="encoding.string" />
		<convert id="other_encoding2" mode="and" sources="other_encoding;do_locale_conversion.state" />
		<connect governor="other_encoding2" client="user_encoding.enabled" />
		<connect governor="other_encoding2" client="user_encoding.required" />
	</logic>
	<dialog label="Import STATA file">
		<tabbook>
			<tab id="tab_general" label="General">
				<browser type="file" id="file" label="File name" />
				<stretch/>
				<row>
					<saveobject id="saveto" initial="my.stata.data" label="Object to save to"/>
					<checkbox id="doedit" value="1" value_unchecked="0" label="Edit Object" checked="true" />
				</row>
				<stretch/>
				<frame label="Options">
					<checkbox id="convert_dates" checked="true" label="Convert Stata dates to 'Date' class" value="1" value_unchecked="0"/>
					<checkbox id="convert_factors" checked="true" label="Use Stata value labels to create factors?" value="1" value_unchecked="0"/>
					<checkbox id="missing_type" checked="false" label="For version 8 or later, store information about different types of missing data?" value="1" value_unchecked="0"/>
					<checkbox id="convert_underscore" checked="false" label="Convert '_' in Stata variable names to '.' in R names" value="1" value_unchecked="0"/>
					<checkbox id="warn_missing_labels" checked="true" label="Warn if a variable is specified with value labels and those value labels are not present in the file." value="1" value_unchecked="0"/>
				</frame>
			</tab>
			<tab id="tab_encoding" label="Encoding">
				<checkbox id="do_locale_conversion" checked="false" label="Convert string encoding" value="1" value_unchecked="0"/>
				<dropdown id="encoding" label="Convert from:">
					<option value="latin1" label="Latin 1" checked="true"/>
					<option value="UTF-8" label="UTF-8"/>
					<option value="ISO8859-1" label="ISO8859-1 Latin-1 Western European"/>
					<option value="ISO8859-2" label="ISO8859-2 Latin-2 Central European"/>
					<option value="ISO8859-3" label="ISO8859-3 Latin-3 South European"/>
					<option value="ISO8859-4" label="ISO8859-4 Latin-4 North European"/>
					<option value="ISO8859-5" label="ISO8859-5 Latin/Cyrillic"/>
					<option value="ISO8859-6" label="ISO8859-6 Latin/Arabic"/>
					<option value="ISO8859-7" label="ISO8859-7 Latin/Greek"/>
					<option value="MS-GREEK" label="MS-GREEK"/>
					<option value="ISO8859-8" label="ISO8859-8 Latin/Hebrew"/>
					<option value="ISO8859-9" label="ISO8859-9 Latin-5 Turkish"/>
					<option value="ISO8859-10" label="ISO8859-10 Latin-6 Nordic"/>
					<option value="ISO8859-11" label="ISO8859-11 Latin/Thai"/>
					<option value="ISO8859-13" label="ISO8859-13 Latin-7 Baltic Rim"/>
					<option value="ISO8859-14" label="ISO8859-14 Latin-8 Celtic"/>
					<option value="ISO8859-15" label="ISO8859-15 Latin-9 Western Europen (EUR)"/>
					<option value="ISO8859-16" label="ISO8859-16 Latin-10 South-Eastern European"/>
					<option value="other" label="Other (specify below)"/>
				</dropdown>
				<input id="user_encoding" label="Other encoding" />
			</tab>
		</tabbook>
	</dialog>
</document>
------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
RKWard-devel mailing list
RKWard-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rkward-devel

Reply via email to