How to display a fragment of R?

I read the source code of R, trying to understand how it handles help pages (e.g. ?c ). I think using less , but I could not find a function that does this. I think I could do system(gettextf("echo %s | less", my_text)) , but it will not work on Windows.

+6
source share
2 answers

See ?page and ?file.show :

 page(runif(1e5)) 
+7
source

+1 to @sgibb, page() really helpful. In some cases, I want to go with a more complicated solution. Can you also use ? Sink combined with ? File.show :

 sink(file="tempSink", type="output") ... # various commands ... sink() file.show(file="tempSink", delete.file=TRUE, title="my output") 

For example, page() displays only one output, but you can look at a few together. I also noted that sometimes page() does not work, but the above (I don’t know why - it might just be a mistake).

+2
source

Source: https://habr.com/ru/post/948864/


All Articles