[R] R as Unix-Filter and Streams for DataMining

Jens Oehlschlägel-Akiyoshi jens.oehlschlaegel-akiyoshi at mdfactory.de
Fri Dec 3 16:01:29 CET 1999


My workaround currently is:

(1) Write the path and name of your input file into a file with a *fixed*
name
    use unix paths //// never windows \\\\, e.g.

  d:/temp/filename.txt

(2) Call R via Batchfile

(3) In the batch file set a temporary user dir for R

  set R_USER=d:/temp

(4) Have an approbriate .Profile in this temporary user dir, which defines
.First
    Do *not* take other actions in .Profile except for setting options and
defining .First

.First <- function(){
  # get filename
  filename <- scan("d:/temp/filename.txt", what=character(0))
  cat("filename is ", filename, "\n")
  # make use of filename
  source(filename)
  # exit from R
  q()
}


If you discover a simpler solution, please give me a note
Best


-----Original Message-----
From: owner-r-help at stat.math.ethz.ch
[mailto:owner-r-help at stat.math.ethz.ch]On Behalf Of Christoph M.
Friedrich
Sent: Friday, December 03, 1999 1:38 PM
To: r-help at stat.math.ethz.ch
Subject: [R] R as Unix-Filter and Streams for DataMining


Hi,
i want to use R as a filter in a Unix-like way. So i want to start it
with

producerTool | R --no-save --no-restore --slave < Rscript |
anotherConsumerUnixTool

inside the Script i put the results to stdout, works fine, but how to
read in
from stdin? Its obvious that i have to source the Rscript in a different
way. Any Hints?

My second question is, if there is a possibility to use something like
the Scheme Streams
(see Abelson/Sussman "Structure and Interpretation of Computer
Programs") for input of Huge Amounts of Data, that do not fit in the
main memory, or to reduce the necessary amount of memory? The
application
i have in mind is: Generate from a training set a linear or other model
and then
pipe in a file with the test cases (as stream with read.table) and give
the output to stdout. Is there
any concept in R like this?

Thanks in advance
  Chris
--
Christoph M. Friedrich        | mailto:friedrich at computer.org
Gesellschaft für Modulfermenterbau mbH (GfM mbH) |
http://www.tussy.uni-wh.de/~chris
Alfred-Herrhausen Str. 44 ; D-58455 Witten, Germany
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._.
_._

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list