Skip to contents

The function opens a PDF device with pdf, executes the given expressions, closes the PDF file and displays the file in a PDF viewer.

Usage

toPdf(expressions, pdfFile = NULL, ...)

Arguments

expressions

R expressions creating plots that are to be redirected into a pdf file. You may pass multiple expressions within opening and closing curly braces

pdfFile

optional. Path to the PDF file to be created. The directory part of the path must exist. If not given or NULL, the PDF file is created in the tempdir() folder.

...

further arguments passed to pdf

Value

The function returns the path to the created PDF file.

Examples

if (FALSE) {
toPdf({
  plot(1:10, 10:1)
  barplot(1:10)
  hist(rnorm(100))
})
}