[R] How to start console output with a comment sign (as in knitr)

2013-03-02 Thread Marcus Kriele
Dear all, knitr writes a comment sign in front of each line of console output. This extremely useful, especially for beginners who are starting to write scripts. One could just compose their script in the console (getting immediate output) and then copy the whole chunk into their .r-file. I

Re: [R] How to start console output with a comment sign (as in knitr)

2013-03-02 Thread Bert Gunter
?options Change the prompt option: options(prompt = # ) ## is I think what you want. -- Bert On Sat, Mar 2, 2013 at 5:35 AM, Marcus Kriele mkri...@me.com wrote: Dear all, knitr writes a comment sign in front of each line of console output. This extremely useful, especially for beginners

Re: [R] How to start console output with a comment sign (as in knitr)

2013-03-02 Thread Greg Snow
Try the following to see if it does what you want: ## init con - textConnection(output, w) options(echo=FALSE) sink(con) addTaskCallback( function(expr, out, err, vis) { sink() close(con) if(vis) { cat(paste(#, output, collapse=\n), \n) } con - textConnection(output, w) sink(con) TRUE }) 3+4

Re: [R] How to start console output with a comment sign (as in knitr)

2013-03-02 Thread Marcus Kriele
Thanks Greg, this is great! Regards, Marcus On 2013-03-02, at 19:06 , Greg Snow wrote: Try the following to see if it does what you want: ## init con - textConnection(output, w) options(echo=FALSE) sink(con) addTaskCallback( function(expr, out, err, vis) { sink()