Skip to content
Prev 58694 / 398502 Next

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

On Mon, 8 Nov 2004 davidr at rhotrading.com wrote:

            
You can cheat by writing out the history to a file, appending to the file, 
then reading the history back in.
file1 <- tempfile("Rrawhist")
  on.exit(unlink(file1))
  savehistory(file1)
  conn<-file(file1,open="a")
  writeLines(comment, con=conn)
  close(conn)
  loadhistory(file1)
}

I now can get from history()

rewriteHistory("## 1984-4-12 13:00:00 GMT")
## 1984-4-12 13:00:00 GMT
rewriteHistory("TRUE == FALSE")
TRUE == FALSE

You still get the rewriteHistory() calls, though.


 	-thomas