Clearing Console; of weeks of codes!

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Clearing Console; of weeks of codes!

YAddo
Dear All:

I do see I have weeks of codes in my console when I check with my arrow up keys.  I have been clearing them with Control L but it seems to clear it clear the screen temporally. I do see the previous codes again when I open R the next day, after quitting the session!

Q:
How do I clear this?


Thanks;

YA
Reply | Threaded
Open this post in threaded view
|

Re: Clearing Console; of weeks of codes!

1Rnwb
click in console window and type  rm(list=ls(all=TRUE)),
everything will be gone
Reply | Threaded
Open this post in threaded view
|

Re: Clearing Console; of weeks of codes!

Philipp Pagel-5
In reply to this post by YAddo
> I do see I have weeks of codes in my console when I check with my arrow up
> keys.  I have been clearing them with Control L but it seems to clear it
> clear the screen temporally.

CTRL-L simply clears the screen and not the history.

> I do see the previous codes again when I open R
> the next day, after quitting the session!
>
> Q:
> How do I clear this?

What you are seeing is the R history which is stored in the file
.Rhistory in the current working directory when the session is closed
or savehistory() is used. Deleting that file before starting R will
"clear" the history. I am not sure you can clear the history of a
running R session. Deleting the file will not work while the session
is open because the history is in memory at that time and I am not
aware of a command to manipulate the current history.

The environment variable R_HISTSIZE can be used to control the size
of the history.

see ?history for details.

cu
        Philipp

--
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
Maximus-von-Imhof-Forum 3
85354 Freising, Germany
http://webclu.bio.wzw.tum.de/~pagel/

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Clearing Console; of weeks of codes!

Philipp Pagel-5
In reply to this post by YAddo

Please reply to the list, so the OP and otheres following the thread
can see your contributions. I'm taking this back to r-help.

On Thu, Apr 14, 2011 at 01:43:31AM -0700, Mohammad Tanvir Ahamed wrote:
> you can try it ...
>
> rm(list=ls())

No - this has been suggested before and saying it gain does not make
it less wrong: rm() will delete objects from the workspace but has
absolutely no effect on the history.

cu
        Philipp


> /.......Tanvir Ahamed
>
>
>     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
>     From: Philipp Pagel <[hidden email]>
>     To: [hidden email]
>     Sent: Thursday, April 14, 2011 10:23 AM
>     Subject: Re: [R] Clearing Console; of weeks of codes!
>
>     > I do see I have weeks of codes in my console when I check with my arrow
>     up
>     > keys.  I have been clearing them with Control L but it seems to clear it
>     > clear the screen temporally.
>
>     CTRL-L simply clears the screen and not the history.
>
>     > I do see the previous codes again when I open R
>     > the next day, after quitting the session!
>     >
>     > Q:
>     > How do I clear this?
>
>     What you are seeing is the R history which is stored in the file
>     .Rhistory in the current working directory when the session is closed
>     or savehistory() is used. Deleting that file before starting R will
>     "clear" the history. I am not sure you can clear the history of a
>     running R session. Deleting the file will not work while the session
>     is open because the history is in memory at that time and I am not
>     aware of a command to manipulate the current history.
>
>     The environment variable R_HISTSIZE can be used to control the size
>     of the history.
>
>     see ?history for details.
>
>     cu
>         Philipp
>
>     --
>     Dr. Philipp Pagel
>     Lehrstuhl f r Genomorientierte Bioinformatik
>     Technische Universit t M nchen
>     Wissenschaftszentrum Weihenstephan
>     Maximus-von-Imhof-Forum 3
>     85354 Freising, Germany
>     http://webclu.bio.wzw.tum.de/~pagel/
>
>     ______________________________________________
>     [hidden email] 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.
>
>
>

--
Dr. Philipp Pagel
Lehrstuhl für Genomorientierte Bioinformatik
Technische Universität München
Wissenschaftszentrum Weihenstephan
Maximus-von-Imhof-Forum 3
85354 Freising, Germany
http://webclu.bio.wzw.tum.de/~pagel/

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Clearing Console; of weeks of codes!

1Rnwb
In reply to this post by Philipp Pagel-5
Thanks, I thought that removing the list would take care of it. the question is I do not see a .Rhistory file in my current working directory, so where it is stored. it is not visible in C:\Program files\R either. Serarching the C;\ and D:\ drives shows some old .Rhistory files but not the recent ones.
Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Clearing Console; of weeks of codes!

Brad Schneid
If you don't want your history, why not just do this.

>q()

Save workspace image? [y/n/c]:

>n


??
Am I missing something?
1Rnwb wrote
Thanks, I thought that removing the list would take care of it. the question is I do not see a .Rhistory file in my current working directory, so where it is stored. it is not visible in C:\Program files\R either. Serarching the C;\ and D:\ drives shows some old .Rhistory files but not the recent ones.
Thanks
Reply | Threaded
Open this post in threaded view
|

Re: Clearing Console; of weeks of codes!

YAddo
Yep... Hitting the up arrow key upon the next initialization shows all the previous codes.
I.e.  after  q() ------- Y and re opening R console the next time.


Reply | Threaded
Open this post in threaded view
|

Re: Clearing Console; of weeks of codes!

Joshua Wiley-2
In reply to this post by 1Rnwb
On Thu, Apr 14, 2011 at 7:47 AM, 1Rnwb <[hidden email]> wrote:
> Thanks, I thought that removing the list would take care of it. the question
> is I do not see a .Rhistory file in my current working directory, so where
> it is stored. it is not visible in C:\Program files\R either. Serarching the
> C;\ and D:\ drives shows some old .Rhistory files but not the recent ones.
> Thanks

The .Rhistory file is stored in the working directory.  You hit on the
issue exactly when you said, "it is not **visible**".  Google
something like: "windows files starting with period" to find
directions for how to make it visible using Windows Explorer.
Alternately you can use the command prompt, cd to navigate to the
directory, "dir" to list the files and "del" to delete it (of course
it can be done in one step if you know the path).

Cheers,

Josh

>
> --
> View this message in context: http://r.789695.n4.nabble.com/Clearing-Console-of-weeks-of-codes-tp3447506p3449832.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> [hidden email] 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.
>



--
Joshua Wiley
Ph.D. Student, Health Psychology
University of California, Los Angeles
http://www.joshuawiley.com/

______________________________________________
[hidden email] 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.