DATA MINING
Desktop Survival Guide by Graham Williams |
|||||
Scripts |
On GNU/Linux there are several options for a shell script to run Rattle. A simple script might be:
#!/bin/sh wd=${PWD} if [ ! -d ${HOME}/rattle ]; then mkdir ${HOME}/rattle; fi echo "library(rattle); setwd(\"${wd}\"); rattle()" \ > ${HOME}/rattle/.Rprofile gnome-terminal --working-directory=${HOME}/rattle \ --title="Rattle: R Console" \ --hide-menubar --execute "R" |
${HOME}/bin
.
Another possibility is to have a loop that waits for a sign that
Rattle has terminated, buy placing the following into a file,
perhaps called start_rattle.R
:
library(rattle) rattle() while (!is.null(rattleGUI)) Sys.sleep(5) |
$ R --no-save < start_rattle.R |
rattle()
actually dispatches and
returns control back to the console. Without the while loop the script
(and thus Rattle) terminate as soon as it starts. The sleep/loop
waits for the "rattleGUI" variable to be set to NULL (which Rattle
does on quitting) and then terminates. This is not so useful since it
locks the console, although for some purposes it might be desirable.
Up to 5 seconds of delay on exit could also be annoying.
Copyright © Togaware Pty Ltd Support further development through the purchase of the PDF version of the book.