[R] .Last function in R 4.1.0

Paul Louisell p|out@|7 @end|ng |rom gm@||@com
Mon Jun 7 06:00:32 CEST 2021


Here's my relevant OS / version info for background:
R version 4.1.0 (2021-05-18)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)
Here's the problem: I've inserted the following lines *only *into my
Rprofile.site file in the etc folder:
if(interactive()){
.Last=function(){
timestamp(stamp=date(), prefix = "##------ ", suffix = " ------##")
savehistory()
}
}
This is a basic .Last function to automatically insert a timestamp into the
history and save it at the end of an interactive R session. Prior to R
4.1.0, I'd never received an error from these lines. But in version 4.1.0
on startup, I get this error:
Error: cannot add binding of '.Last' to the base environment

And (as expected given the error) the .Last function is not in the
workspace:
> .Last
Error: object '.Last' not found
The same thing happens when I start up the 32-bit version. Section 10.8
(pg. 54) of *R-intro.pdf *still has the documentation for .First and .Last,
and shows examples where you place the function definitions in the
Rprofile.site file, as well as other locations. *fullrefman.pdf *also has
documentation for these functions. So my question:

   - Is this a bug? Or does R not support .First / .Last anymore, and the
   documents just need updating?

Thanks for your help with this,
Paul Louisell

	[[alternative HTML version deleted]]



More information about the R-help mailing list