Someone on stackoverflow.com was wondering how to display the current time in the R prompt. I could have swore there was a mechanism for hooking a function into R such that it is was called before the ">" prompt was given, but no amount of searching in R's docs, R's source, or RSiteSearch can find it. I've searched for 'hook', 'event', 'signal', and various combinations of those with 'console', 'prompt', 'after' and 'before' with no joy. I'm sure other people have asked this on R-help before, but I can't find those messages either. Have I been hallucinating or is my search-fu week this Friday? Barry
On Nov 19, 2010, at 9:23 AM, Barry Rowlingson wrote:> Someone on stackoverflow.com was wondering how to display the current > time in the R prompt. I could have swore there was a mechanism for > hooking a function into R such that it is was called before the ">" > prompt was given, but no amount of searching in R's docs, R's source, > or RSiteSearch can find it. > > I've searched for 'hook', 'event', 'signal', and various combinations > of those with 'console', 'prompt', 'after' and 'before' with no joy. > I'm sure other people have asked this on R-help before, but I can't > find those messages either. > > Have I been hallucinating or is my search-fu week this Friday? > > BarryBaz, What's wrong with:> options(prompt = paste(format(Sys.time(), "%a %b %d %X %Y %Z"), ">"))Fri Nov 19 09:30:53 2010 CST > Fri Nov 19 09:30:53 2010 CST > Fri Nov 19 09:30:53 2010 CST > ? HTH, Marc Schwartz
On Nov 19, 2010, at 10:23 AM, Barry Rowlingson wrote:> Someone on stackoverflow.com was wondering how to display the current > time in the R prompt. I could have swore there was a mechanism for > hooking a function into R such that it is was called before the ">" > prompt was given, but no amount of searching in R's docs, R's source, > or RSiteSearch can find it. > > I've searched for 'hook', 'event', 'signal', and various combinations > of those with 'console', 'prompt', 'after' and 'before' with no joy. > I'm sure other people have asked this on R-help before, but I can't > find those messages either. > > Have I been hallucinating or is my search-fu week this Friday?The question on SO as I understood it was how to get the time on the prompt to keep changing without hitting the enter key. The questioner had already figured out how to use: options(prompt=paste(format(Sys.time(), "%H:%M:%S"),"> ")) -- David Winsemius, MD West Hartford, CT