[rkward-users] Detect running in rkward

Johannes Fichtinger newsletter at fichtinger.org
Mon Oct 3 12:41:48 UTC 2011


Hi,

is there a way to understand during runtime of R if the script is running 
through rkward GUI or on the console? The reason is that I want to use the 
multicore package, in particular the mclapply function, which reliably 
produces errors within rkward.

So I want to do in my .r file something like

if (RUNNING_WITHIN_R) {
	lapply(…)
} else {
	mclapply(…)
}

The reason that I want to have both options is that I am continuously 
extending and testing my script withing rkward, but for doing the actual 
calculations I would prefer to use all cpu’s.

Any idea?

Johannes




More information about the Rkward-users mailing list