[R] Problem with R interface termination

Henrik Bengtsson hb at stat.berkeley.edu
Wed Feb 28 03:15:08 CET 2007


Hi,

this is due to the R.utils library.  Interestingly, others reported
this yesterday.  There are three different ways to get around the
problem right now:  1) Exit R so it does not call .Last() by
quit(runLast=FALSE),  2) load the R.utils package and then exit via
quit() as usual, or 3) remove the faulty .Last() function by
rm(.Last).  (Thus, you don't have kill the R process).

Brief explanation: If you load the R.utils package, it will modify or
create .Last() so that  finalizeSession() (defined in R.utils) is
called, which in turn calls so called registered hook functions
allowing optional code to be evaluated "whenever" R exists, cf.
http://tolstoy.newcastle.edu.au/R/devel/05/06/1206.html.  So, if you
exit R and save the session, this .Last() function will be saved to
your .RData file.  If you then start a new R session and load the
saved .RData, that modified .Last() function will also be loaded.
However, if you now try to exit R again, .Last() will be called which
in turn calls finalizeSession() which is undefined since R.utils is
not loaded and you will get the error that you reported.

I'm testing out an updated version of R.utils (v 0.8.6), which will
not cause this problem in the first place, and will fix the problem in
"faulty" .RData.  I will put in on CRAN as soon as I know it has been
tested thoroughly.  In the meanwhile, you can install it by:

source("http://www.braju.com/R/hbLite.R")
hbLite("R.utils")

To fix an old faulty .RData file, start R in the same directory, then
load the updated R.utils (which will replace that faulty .Last() with
a better one), and then save the session again when you exit R.  When
you do this you will see "Warning message: 'package:R.utils' may not
be available when loading", which is ok.  That should fix your
problems.

Let me know if it works

Henrik (author of R.utils)

On 2/27/07, Bhanu Kalyan.K <kalyansikha at yahoo.com> wrote:
> Dear Sir,
>
> The R interface that i am currently using is R 2.4.1( in Win XP). I am not able to terminate the program by giving the q() command. Each time I pass this command,
>
> > q()
> Error in .Last() : could not find function "finalizeSession"
>
> this error creeps in and it neither allows me to save my workspace nor come out of R. Therefore, whenever this happens, I am forced to end the Rgui.exe process from the task manager.
> Kindly help me fix this problem.
>
> Regards,
>
> Bhanu Kalyan K
>
>
> Bhanu Kalyan K
> B.Tech Final Year, CSE
>
> Tel: +91-9885238228
>
> Alternate E-Mail:
> reach4kalyan at gmail.com
>
>
> ---------------------------------
> Need Mail bonding?
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list