I've been reading the R source code trying to understand how it paginates help pages (for example ?c
). I think it's using less
, but I haven't been able to find the function that does this. I guess I could do system(gettextf("echo %s | less", my_text))
, but it won't work in Windows.
Have a look at ?page
and ?file.show
:
page(runif(1e5))
+1 to @sgibb, page()
is really useful. There are some cases where I want to go with a more complicated solution though. You can also use ?sink in conjunction with ?file.show:
sink(file="tempSink", type="output")
...
# various commands
...
sink()
file.show(file="tempSink", delete.file=TRUE, title="my output")
For example, page()
only displays one output, but you may want to look at several together. I've also noted that sometimes page()
doesn't work, but the above will (I don't know why--it might just be a bug).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With