Skip to content
Prev 175519 / 398506 Next

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

Thanks, Wacek and Romain! Your solutions worked very well in RGui and
Rterm in interactive mode.

My final purpose was to obtain the file name of the postscript device
in Rweb (http://pbil.univ-lyon1.fr/Rweb/); now I found savehistory()
would not work because Rweb was non-interactive. I didn't realize it
until I try(savehistory()) and got an error message.

Now I found a solution by myself: we can list the *.ps files and pick
the most recently created (modified, visited, ...) one, e.g.

x = file.info(list.files(pattern = ".*\\.ps$"))
x = x[order(x$atime), ]
rownames(x)[nrow(x)]

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



On Mon, Mar 23, 2009 at 6:13 PM, Wacek Kusnierczyk
<Waclaw.Marcin.Kusnierczyk at idi.ntnu.no> wrote: