The objective is to have two simple ways to source some code, say func.R, containing a function. Calling R CMD BATCH func.R initializes the function and evaluates is. Within a session, issuing source("func.R") simply initializes the function.
Any idea?
The objective is to have two simple ways to source some code, say func.R,
Share
I think that the
interactive()function might work.This function returns
TRUEwhen R is being used interactively andFALSEotherwise. So just useif (interactive())i.e. the equivalent is