How to "find" in console output?

1,392 views
Skip to first unread message

Michael

unread,
Jul 17, 2015, 7:28:14 PM7/17/15
to davi...@googlegroups.com
Stupid question perhaps, but I need to do ctrl-F style finding in my console output. I'm on Windows. Don't see a way to do it in RStudio or the R GUI. Can do it in my console emulator, but as I'm set up now, that's inconvenient because I have to paste back and forth from the script. So two possible solutions: is there some kind of ctrl-F functionality for output in RStudio or the R GUI, or is there a convenient way to send lines from a script file to my console emulator (cmder), like ctrl-Enter in RStudio?

Noam Ross

unread,
Jul 17, 2015, 7:55:42 PM7/17/15
to davi...@googlegroups.com

This may not quite cover your needs, but sink("output.txt", split=TRUE) will send your console output to output.txt as well as the console window. From there you can search the file however you please. sink("output.txt", type="message") will record messages (Errors and warnings, mostly), but for some reason doesn’t allow split=TRUE, so you don’t see them in your console. sink(NULL) when you’re done stops recording the output.


On Fri, Jul 17, 2015 at 4:28 PM Michael <mle...@gmail.com> wrote:
Stupid question perhaps, but I need to do ctrl-F style finding in my console output. I'm on Windows. Don't see a way to do it in RStudio or the R GUI. Can do it in my console emulator, but as I'm set up now, that's inconvenient because I have to paste back and forth from the script. So two possible solutions: is there some kind of ctrl-F functionality for output in RStudio or the R GUI, or is there a convenient way to send lines from a script file to my console emulator (cmder), like ctrl-Enter in RStudio?

--
Check out our R resources at http://www.noamross.net/davis-r-users-group.html
---
You received this message because you are subscribed to the Google Groups "Davis R Users' Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to davis-rug+...@googlegroups.com.
Visit this group at http://groups.google.com/group/davis-rug.
For more options, visit https://groups.google.com/d/optout.

Michael Levy

unread,
Jul 17, 2015, 8:10:24 PM7/17/15
to davi...@googlegroups.com
Thanks. That is definitely an improvement.

-- 
Michael Levy
c: 304-376-4523

Jaime Ashander

unread,
Jul 17, 2015, 8:38:23 PM7/17/15
to davi...@googlegroups.com
Using R in a bash-similar shell (e.g. on standard shell on mac os x or unix, or cygwin on windows), CTRL-r will do a 'reverse-i-search'. Start typing the search and the first match will show up, hit CTRL-r for subsequent matches

Jaime Ashander

unread,
Jul 17, 2015, 8:40:56 PM7/17/15
to davi...@googlegroups.com
Sorry. Now that I actually read your full question, I see you've got that going.

Both emacs (ESS) and vim (using some tmux thing -- see Vince's page here https://github.com/vsbuffalo/devnotes/wiki/Vim,-R,-and-Tmux:-Minimal-Configuration ) can send lines from a script file to terminal.

sinking and searching is probably the way to go
Reply all
Reply to author
Forward
0 new messages