prOutput: Save plots as image files

Description Usage Arguments Details Value Examples

Description

These functions can be used in place of their corresponding base R functions to save plots as image files.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15

Arguments

name

Name of the output file, without extension. One can also specify subdirectory where to save the file.

...

parameters passed to the corresponding base R function. For instance, for prPng, these parameters will be passed to function png

replace

If the file already exists, should it be overwritten ?

Details

These functions has three advantages over the base functions:

Value

These functions are used to open a plot device. Nothing is returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
projectPath <- file.path(tempdir(), "test")
prInit(projectPath)

prPng("test")
plot(rnorm(100))
dev.off()
# The plot is saved in "output/test.png"
list.files(projectPath, recursive = TRUE, include.dirs = TRUE)

prPng("mysubdirectory/test")
plot(rnorm(100))
dev.off()
# The plot is saved in "output/mysubdirectory/test.png"
list.files(projectPath, recursive = TRUE, include.dirs = TRUE)

tinyProject documentation built on June 14, 2019, 5:04 p.m.