[R] savehistory not working properly in R?

Paul Y. Peng ypeng at math.mun.ca
Wed May 14 20:29:53 CEST 2003

Dear R users,

I have a .RData which contains .Last object as follows:

	.Last <- function () 
		savehistory(file = ".Rhistory")

In this directory, if I issue the following command

	Rterm --save < mycmds.q

to execute commands in mycmds.q and to save results in .RData,
I got the following error message towards the end of the execution:

	Error in savehistory(file) : savehistory can only be used
	in Rgui and Rterm
	Execution halted

I lost the results of the commands too. The documentation of
"savehistory" says that it only works with Rgui and Rterm. Why
doesn't it work in this case? Is it because it is in a batch mode
rather than in an interactive mode? I did this in Windows98 with
the following R

	> version
	platform i386-pc-mingw32
	arch     i386           
	os       mingw32        
	system   i386, mingw32  
	major    1              
	minor    6.2            
	year     2003           
	month    01             
	day      10             
	language R

I tested it in Linux with the same version R and the same problem

Is it possible to prevent savehistory from printing the error message
so that the session can be finished properly? I hope that I did not
miss anything obvious. Otherwise, please forgive me. Thanks.


More information about the R-help mailing list