[R] How to get commands history as a character vector instead of displaying them?

Yihui Xie xieyihui at gmail.com
Mon Mar 23 09:59:44 CET 2009


Hi Everyone,

I want to get the commands history as a character vector instead of
just displaying them, but the function history() just returns NULL. I
checked the source code of 'history' and could not find a solution.
Anybody has an idea? Thanks!

P. S. My original problem is, when a user opens a graphics device like
png() or pdf(), I want to know the file name used by this device. I
thought history() would help, but it could not.

> sessionInfo()
R version 2.8.1 (2008-12-22)
i386-pc-mingw32

locale:
LC_COLLATE=Chinese_People's Republic of
China.936;LC_CTYPE=Chinese_People's Republic of
China.936;LC_MONETARY=Chinese_People's Republic of
China.936;LC_NUMERIC=C;LC_TIME=Chinese_People's Republic of China.936

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Phone: +86-(0)10-82509086 Fax: +86-(0)10-82509086
Mobile: +86-15810805877
Homepage: http://www.yihui.name
School of Statistics, Room 1037, Mingde Main Building,
Renmin University of China, Beijing, 100872, China




More information about the R-help mailing list