[R] can one evaluate an expression in a comment? (or insert resultsinto history?)

davidr@rhotrading.com davidr at rhotrading.com
Mon Nov 8 23:27:58 CET 2004


But that doesn't put the result into the history buffer, to be written
to a file only later when I savehistory(filename).

Bert Gunter also suggested ?capture.output and ?textConnection,
but I cannot see how to get text into the history buffer as comments,
but with evaluated expressions (values).

I know how to use paste, sink, write, etc. but nothing that I can see
inserts into the history buffer. I'm trying to avoid cutting and pasting
the results into a comment.

Thanks for any more help on this,
David

-----Original Message-----
From: partha_bagchi at hgsi.com [mailto:partha_bagchi at hgsi.com] 
Sent: Monday, November 08, 2004 4:07 PM
To: David Reiner <davidr at rhotrading.com>
Cc: r-help at stat.math.ethz.ch
Subject: Re: [R] can one evaluate an expression in a comment? (or insert
resultsinto history?)

Have you perchance looked at
?paste

For example:
> paste("The current time is ", date())
[1] "The current time is  Mon Nov 08 17:06:25 2004"
>





<davidr at rhotrading.com>
Sent by: r-help-bounces at stat.math.ethz.ch
11/08/2004 04:47 PM

 
        To:     <r-help at stat.math.ethz.ch>
        cc: 
        Subject:        [R] can one evaluate an expression in a comment?
(or insert results into 
history?)


I'd like to insert (for example) the current datetime into a comment so
it goes into the history.

I can of course cut and paste the results of date() into a comment line,


but it would be easier and more powerful to be able to type something
like

> hstamp()

and have it go into the history.

More generally, I would like to put any expression to be evaluated into
this function.

For example,

> hstamp(memory.size(TRUE))

would insert a comment like

# 12279808

after the hstamp command into the history.

Probably one should avoid any expressions with assignment effects or
large amounts of output.



Maybe I'm thinking about this all wrong, so please enlighten me if so.

I searched all the help and archives as well as I could.



--------------

> version

_

platform i386-pc-mingw32

arch     i386

os       mingw32

system   i386, mingw32

status   Patched

major    2

minor    0.0

year     2004

month    10

day      18

language R



Thanks!

David L. Reiner



Rho Trading

440 S. LaSalle St -- Suite 620

Chicago  IL  60605



312-362-4963 (voice)

312-362-4941 (fax)






[[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




More information about the R-help mailing list