Skip to content

Script to start Rcmdr

4 messages · Ronaldo Reis Junior, John Fox, Brian Ripley +1 more

#
Hi,

anybody know any way to make a bash script to start Rcmdr directly widthout 
need to open R and execute library(Rcmdr)?

I try to make this using R CMD BATCH somethink, but dont find the way.

Thanks
Ronaldo
--
|  .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Biologia Computacional
| : :'  : Campus Universit?rio Prof. Darcy Ribeiro, Vila Mauric?ia
| `. `'` CP: 126, CEP: 39401-089, Montes Claros - MG - Brasil
|   `- Fone: (38) 3229-8187 | ronaldo.reis em unimontes.br | chrysopa em gmail.com
| http://www.ppgcb.unimontes.br/ | ICQ#: 5692561 | LinuxUser#: 205366
#
Dear Ronaldo,

You should be able to put

local({
old <- getOption("defaultPackages")
options(defaultPackages = c(old, "Rcmdr"))
})

in an .Rprofile file in a directory reserved for this purpose, and have your
bash script start R from that directory (untested). See ?Startup for details
on how R starts.

I hope this helps,
 John

--------------------------------
John Fox, Professor
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
905-525-9140x23604
http://socserv.mcmaster.ca/jfox
#
On Mon, 3 Mar 2008, Ronaldo Reis Junior wrote:

            
For some reason, Rcmdr requires an interactive session:

gannet% Rscript -e 'library(Rcmdr)'
Loading required package: tcltk
Loading Tcl/Tk interface ... done
The Commander GUI is launched only in interactive sessions

However, I was able to do

gannet% cat foo
#!/bin/sh
R_DEFAULT_PACKAGES=Rcmdr R

Probably you need R in interactive mode to respond to the Tcl/Tk callbacks 
(and not just terminate when no input is found).
#
On Mon, Mar 03, 2008 at 10:13:53AM -0300, Ronaldo Reis Junior wrote:
$ r -lRcmdr -e'while(TRUE) Sys.sleep(1)'

where r is the binary from our littler tool.  This loads the Rmcdr
package with the -l | --library switch abnd then evals a simple loop
to keep running.  You need to kill that loop with Crtrl-c at the end.

Dirk