prBmp {tinyProject}R Documentation

Save plots as image files

Description

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

Usage

prBmp(name, ..., replace = FALSE)

prJpeg(name, ..., replace = FALSE)

prPng(name, ..., replace = FALSE)

prTiff(name, ..., replace = FALSE)

prPdf(name, ..., replace = FALSE)

prSvg(name, ..., replace = FALSE)

prCairoPdf(name, ..., replace = FALSE)

prCairoPs(name, ..., replace = FALSE)

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

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)


[Package tinyProject version 0.6.1 Index]