[rkward-cvs] SF.net SVN: rkward: [1633] trunk/rkward/rkward/plugins/00saveload
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Mon Mar 19 18:04:43 UTC 2007
Revision: 1633
http://svn.sourceforge.net/rkward/?rev=1633&view=rev
Author: tfry
Date: 2007-03-19 11:04:43 -0700 (Mon, 19 Mar 2007)
Log Message:
-----------
Some more fixes for running inside local, and small cleanups
Modified Paths:
--------------
trunk/rkward/rkward/plugins/00saveload/import/import_csv.php
trunk/rkward/rkward/plugins/00saveload/import/import_spss.php
trunk/rkward/rkward/plugins/00saveload/save/save/code.php
trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.php
trunk/rkward/rkward/plugins/00saveload/save/write/code.php
trunk/rkward/rkward/plugins/00saveload/setworkdir.php
Modified: trunk/rkward/rkward/plugins/00saveload/import/import_csv.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_csv.php 2007-03-19 06:17:20 UTC (rev 1632)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_csv.php 2007-03-19 18:04:43 UTC (rev 1633)
@@ -26,7 +26,7 @@
# doing col class (what a pity...)
if (getRK_val("colclass") == "custoClass") echo( "colClasses = " . getRK_val ("custoClasses") . ",");
#doing what is left
-?> na.strings = "<? getRK("na") ?>", nrows = <? getRK("nrows") ; ?>, skip = <? getRK("skip") ; ?>, check.names = <? getRK("checkname") ; ?>, fill = <? getRK("fill") ; ?>, strip.white = <? getRK("stripwhite") ; ?>, blank.lines.skip = <? getRK("blanklinesskip") ; ?>, comment.char=<? echo (quoteString (getRK_val("commentchar"))); ?><? getRK("allow_escapes"); ?><? getRK("flush"); ?><? getRK("strings_as_factors"); ?>)
+?> na.strings = "<? getRK("na") ?>", nrows = <? getRK("nrows") ; ?>, skip = <? getRK("skip") ; ?>, check.names = <? getRK("checkname") ; ?>, fill = <? getRK("fill") ; ?>, strip.white = <? getRK("stripwhite") ; ?>, blank.lines.skip = <? getRK("blanklinesskip") ; ?>, comment.char=<? echo (quoteString (getRK_val("commentchar"))); ?><? getRK("allow_escapes"); ?><? getRK("flush"); ?><? getRK("strings_as_factors"); ?>)
<? if (getRK_val ("doedit")) { ?>
rk.edit (<? getRK ("name"); ?>)
@@ -34,9 +34,5 @@
}
function printout () {
-// produce the output
}
-
-function cleanup () {
-}
?>
Modified: trunk/rkward/rkward/plugins/00saveload/import/import_spss.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/import/import_spss.php 2007-03-19 06:17:20 UTC (rev 1632)
+++ trunk/rkward/rkward/plugins/00saveload/import/import_spss.php 2007-03-19 18:04:43 UTC (rev 1633)
@@ -4,15 +4,15 @@
<? if (getRK_val ("do_locale_conversion")) { ?>
# helper function to convert all strings to the current encoding
-rk.temp.convert <- function (x, from) {
+iconv.recursive <- function (x, from) {
attribs <- attributes (x);
if (is.character (x)) {
x <- iconv (x, from=from, to="", sub="")
} else if (is.list (x)) {
- x <- lapply (x, function (sub) rk.temp.convert (sub, from))
+ x <- lapply (x, function (sub) iconv.recursive (sub, from))
}
# convert factor levels and all other attributes
- attributes (x) <- lapply (attribs, function (sub) rk.temp.convert (sub, from))
+ attributes (x) <- lapply (attribs, function (sub) iconv.recursive (sub, from))
x
}
<? }
@@ -40,17 +40,17 @@
} ?>
# convert all strings to the current encoding
-<? echo ($object); ?> <- rk.temp.convert (<? echo ($object); ?>, from="<? echo ($from_locale); ?>")
+<? echo ($object); ?> <- iconv.recursive (<? echo ($object); ?>, from="<? echo ($from_locale); ?>")
<? }
if (getRK_val ("convert_var_labels")) { ?>
# set variable labels for use in RKWard
-rk.temp.labels <- attr (<? echo ($object); ?>, "variable.labels");
-if (!is.null (rk.temp.labels)) {
- for (rk.temp.i in 1:length (rk.temp.labels)) {
- rk.temp.col <- make.names (names (rk.temp.labels[rk.temp.i]))
- if (!is.null (rk.temp.col)) {
- rk.set.label (<? echo ($object); ?>[[rk.temp.col]], rk.temp.labels[rk.temp.i])
+labels <- attr (<? echo ($object); ?>, "variable.labels");
+if (!is.null (labels)) {
+ for (i in 1:length (labels)) {
+ col <- make.names (names (labels[i]))
+ if (!is.null (col)) {
+ rk.set.label (<? echo ($object); ?>[[col]], labels[i])
}
}
}
@@ -64,9 +64,4 @@
function printout () {
}
-
-function cleanup () { ?>
-rm (list=grep ("^rk.temp", ls (), value=TRUE))
-<?
-}
?>
Modified: trunk/rkward/rkward/plugins/00saveload/save/save/code.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/save/code.php 2007-03-19 06:17:20 UTC (rev 1632)
+++ trunk/rkward/rkward/plugins/00saveload/save/save/code.php 2007-03-19 18:04:43 UTC (rev 1633)
@@ -1,17 +1,14 @@
<?
- function preprocess () {
- }
-
- function calculate () {
+function preprocess () {
+}
+
+function calculate () {
$vars = str_replace ("\n", ",", trim (getRK_val ("data"))) ;
?>
save (<? echo ($vars); ?>, file="<? getRK("file"); ?>", ascii=<? getRK("ascii"); ?>, compress=<? getRK("compress"); ?>)
<?
- }
-
- function printout () {
- }
-
- function cleanup () {
- }
+}
+
+function printout () {
+}
?>
Modified: trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.php 2007-03-19 06:17:20 UTC (rev 1632)
+++ trunk/rkward/rkward/plugins/00saveload/save/skeleton/code.php 2007-03-19 18:04:43 UTC (rev 1633)
@@ -1,17 +1,14 @@
<?
- function preprocess () {
- }
-
- function calculate () {
+function preprocess () {
+}
+
+function calculate () {
$vars = str_replace ("\n", "','", trim (getRK_val ("data"))) ;
?>
package.skeleton(name="<? getRK("name"); ?>", list=c('<? echo ($vars); ?>'), path="<? getRK("path"); ?>", force= "<? getRK("force"); ?>")
<?
- }
-
- function printout () {
- }
-
- function cleanup () {
- }
+}
+
+function printout () {
+}
?>
Modified: trunk/rkward/rkward/plugins/00saveload/save/write/code.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/save/write/code.php 2007-03-19 06:17:20 UTC (rev 1632)
+++ trunk/rkward/rkward/plugins/00saveload/save/write/code.php 2007-03-19 18:04:43 UTC (rev 1633)
@@ -1,16 +1,13 @@
<?
- function preprocess () {
- }
-
- function calculate () {
+function preprocess () {
+}
+
+function calculate () {
?>
write (x=<? getRK("data"); ?>, file="<? getRK("file"); ?>", ncolumns=<? getRK("ncolumns"); ?>, append=<? getRK("append"); ?>)
<?
- }
-
- function printout () {
- }
-
- function cleanup () {
- }
+}
+
+function printout () {
+}
?>
Modified: trunk/rkward/rkward/plugins/00saveload/setworkdir.php
===================================================================
--- trunk/rkward/rkward/plugins/00saveload/setworkdir.php 2007-03-19 06:17:20 UTC (rev 1632)
+++ trunk/rkward/rkward/plugins/00saveload/setworkdir.php 2007-03-19 18:04:43 UTC (rev 1633)
@@ -1,12 +1,14 @@
<?php
function preprocess () {
}
+
function calculate () {
- $dir = getRK_val ("dir");
+ $dir = getRK_val ("dir");
?>
setwd("<? echo ($dir); ?>")
<?
}
+
function printout () {
}
?>
\ No newline at end of file
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