[R] How to retrieve results of most recent command?

Yeh, Richard C richard.c.yeh at bankofamerica.com
Fri Sep 22 17:45:49 CEST 2006


In R, is there an automatic variable that stores the results of the most
recent command or commands?  (I am thinking of a behavior like
Mathematica's % result-history substitution syntax.)


(I am using R 2.3.1 on Linux and R 2.3.1 on Windows XP.)


This is a pretty basic question, so I tried to do an extensive version
of the recommended pre-posting homework.

> help.search('substitution')
failed to turn up anything relevant.  This is more an environmental
question, not an R-language programming question.

> help.search('history')
was interesting, but focused on command history.  'savehistory' appears
to be an atomic function, so the temporary-file manipulation done by
'history' seems required.  Perhaps I could try store the desired line in
a string and then evaluate it, but this method feels terribly clunky.
On the other hand, that may be the price to pay for avoidance of
creeping featurism.

The top 10 RSiteSearch results also focus on saving the command
histories to a file or script.  The 'Emacs Speaks Statistics' (ESS)
package seems to offer shortcuts for command history expansion, but not
results history.  I'm a bit reluctant to start using Emacs again, having
quit it for VI over a decade ago.



212-933-3305 / richard.c.yeh at bankofamerica.com 


NOTICE TO RECIPIENTS: Any information contained in or attached
to this message is intended solely for the use of the intended
recipient(s). If you are not the intended recipient of this
transmittal, you are hereby notified that you received this
transmittal in error and we request that you please delete and
destroy all copies and attachments in your possession, notify
the sender that you have received this communication in error,
and note that any review or dissemination of, or the taking of
any action in reliance on, this communication is expressly
prohibited. 

Banc of America Securities LLC ("BAS") does not accept time
sensitive, action-oriented messages or transaction orders,
including orders to purchase or sell securities, via e-mail.

Regular internet e-mail transmission cannot be guaranteed to be
secure or error-free.  Therefore, we do not represent that this
information is complete or accurate and it should not be relied
upon as such.  If you prefer to communicate with BAS using secure
(i.e., encrypted) e-mail transmission, please notify the sender.
Otherwise, you will be deemed to have consented to communicate
with BAS via regular internet e-mail transmission.  Please note
that BAS reserves the right to intercept, monitor, and retain all
e-mail messages (including secure e-mail messages) sent to or
from its systems as permitted by applicable law.

-------------------------------------------------------------------
IRS Circular 230 Disclosure:

Bank of America Corporation and its affiliates, including BAS,
("Bank of America") do not provide tax advice. Accordingly, any
statements contained herein as to tax matters were neither written
nor intended by the sender or Bank of America to be used and cannot
be used by any taxpayer for the purpose of avoiding tax penalties
that may be imposed on such taxpayer. If any person uses or refers
to any such tax statement in promoting, marketing or recommending a
partnership or other entity, investment plan or arrangement to any
taxpayer, then the statement expressed above is being delivered to
support the promotion or marketing of the transaction or matter
addressed and the recipient should seek advice based on its
particular circumstances from an independent tax advisor.



More information about the R-help mailing list