Aliases: Pager PagerOff, PagerSystem, PagerSystemLess, PagerBrowser PagerOff-class PagerOff PagerSystem-class PagerSystem PagerSystemLess-class PagerSystemLess
Keywords:
### ** Examples ## We `dontrun` these examples as they involve pagers that should only be run ## in interactive mode ## Not run: ##D ## Specify Pager parameters via list; this lets the `diff*` functions pick ##D ## their preferred pager based on format and other output parameters, but ##D ## allows you to modify the pager behavior. ##D ##D f <- tempfile() ##D diffChr(1:200, 180:300, format='html', pager=list(file.path=f)) ##D head(readLines(f)) # html output ##D unlink(f) ##D ##D ## Assuming system pager is `less` and terminal supports ANSI ESC sequences ##D ## Equivalent to running `less -RFX` ##D ##D diffChr(1:200, 180:300, pager=PagerSystemLess(flags="RFX")) ##D ##D ## If the auto-selected pager would be the system pager, we could ##D ## equivalently use: ##D ##D diffChr(1:200, 180:300, pager=list(flags="RFX")) ##D ##D ## System pager is not less, but it supports ANSI escape sequences ##D ##D diffChr(1:200, 180:300, pager=PagerSystem(ansi=TRUE)) ##D ##D ## Use a custom pager, in this case we make up a trivial one and configure it ##D ## always page (`threshold=0L`) ##D ##D page.fun <- function(x) cat(paste0("| ", readLines(x)), sep="\n") ##D page.conf <- PagerSystem(pager=page.fun, threshold=0L) ##D diffChr(1:200, 180:300, pager=page.conf, disp.width=getOption("width") - 2) ##D ##D ## Set-up the custom pager as the default pager ##D ##D options(diffobj.pager=page.conf) ##D diffChr(1:200, 180:300) ##D ##D ## A blocking pager (this is effectively very similar to what `PagerBrowser` ##D ## does); need to block b/c otherwise temp file with diff could be deleted ##D ## before the device has a chance to read it since `browseURL` is not ##D ## blocking itself. On OS X we need to specify the extension so the correct ##D ## program opens it (in this case `TextEdit`): ##D ##D page.conf <- Pager(pager=browseURL, file.ext="txt", make.blocking=TRUE) ##D diffChr(1:200, 180:300, pager=page.conf, format='raw') ##D ##D ## An alternative to a blocking pager is to disable the ##D ## auto-file deletion; here we also specify a file location ##D ## explicitly so we can recover the diff text. ##D ##D f <- paste0(tempfile(), ".html") # must specify .html ##D diffChr(1:5, 2:6, format='html', pager=list(file.path=f)) ##D tail(readLines(f)) ##D unlink(f) ## End(Not run)