From skostysh at princeton.edu  Sun Dec 29 03:19:20 2013
From: skostysh at princeton.edu (Scott Kostyshak)
Date: Sat, 28 Dec 2013 21:19:20 -0500
Subject: [Rd] help page of warnings()
In-Reply-To: <CA+aKpMd+eUty3BM+eirvBQ3CB8hr_PBKZ5eq-Yehz-TQEgnHEw@mail.gmail.com>
References: <CA+aKpMd+eUty3BM+eirvBQ3CB8hr_PBKZ5eq-Yehz-TQEgnHEw@mail.gmail.com>
Message-ID: <CAE3=dmfvHOw1jais_OO5DW--Z8fkA7rm=SCrBn=jwmFwONMy3g@mail.gmail.com>

On Sat, Dec 28, 2013 at 6:06 PM, Elad Zippory <elad.zippory at gmail.com> wrote:
> Hi,
>
> I raised this issue at stackoverflow and it was suggested to raise it here:
>
> >From the current help page, it is unclear that "warnings()" does not clear
> after rm(list=ls()). Currently the page states that:
>
> "Warning: It is undocumented where last.warning is stored nor that it is
> visible, and this is subject to change. Prior to R 2.4.0 it was stored in
> the workspace, but no longer."
>
> Yet, I suggest that, if to keep the current behavior or until the behavior
> is changed, at least write explicitly in the help file something like
> "clearing the global environment will not clear the warning list. To do so
> use assign("last.warning", NULL, envir = baseenv())"
>
> Thank you,
> Elad Zippory

Hi Elad,

I'm not a decision maker around here but I'm curious about your
suggestion. I always find it helpful to try to understand how people
use R and how they expect R to work.

>From what I understand, you agree that there's no contradiction of
behavior in terms of how R is documented to work and you agree that
rm(list=ls()) should indeed not clear the warnings list. First, let me
give my observation that I think the policy of writing R documentation
is to give sufficient information for what a function does. When there
is something surprising or there are performance issues to keep in
mind, occasionally the R documentation appropriately mentions what a
function does not do.

I think you are interested in making more of a "let's make it easier
on the user" argument so let me try to address that. I think it's easy
to learn how to find the last.warning object. This would only require
a user to read the first line of ?warnings and then to know about the
getAnywhere function. That's it.

In fact, I think that's too easy. I would personally be in favor of
making it _more_ difficult for a beginning user to modify
last.warning. I've never had to do such a thing and I would be
suspicious of beginning/intermediate users who claim there's a need
to. If you want a fresh R session, use a fresh R session. Clearing the
global environment will not give a fresh R session. Clearing the
global environment and clearing warnings will not do so either. In my
opinion, it is tricks like these that can lead to unfortunate
situations where results are not reproducible.

Also, you mention a Stack Overflow question. If you are going to refer
to something, please provide a link (perhaps in a footnote like this
[1] if you do not want to put a long distracting URL in your message).
Maybe there is no useful discussion there, but maybe there is and the
discussion has already raised the points I raise in this email. The
reader of your message is thus left wondering.

Let me note that I'm just an ordinary R user. I hope I don't scare you
off from giving more suggestions and wouldn't be surprised if others
disagree. I hope you send more messages like the one you just sent
because I'm interested in understanding what R users find confusing.

Best regards,

Scott

[1] an old but related Stack Overflow question:
http://stackoverflow.com/questions/5725106/r-how-to-clear-all-warnings

--
Scott Kostyshak
Economics PhD Candidate
Princeton University



[Rd] help page of warnings()
Scott Kostyshak