[R] .Last function in R 4.1.0

Bert Gunter bgunter@4567 @end|ng |rom gm@||@com
Mon Jun 7 16:24:08 CEST 2021


According to the News file for 4.1.0 -- you should always check there first
for such things --

"The base environment and its namespace are now locked (so one can no
longer add bindings to these or remove from these)."

So the docs do seem to need updating.

Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Mon, Jun 7, 2021 at 12:15 AM Paul Louisell <ploutal7 using gmail.com> wrote:

> 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]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list