file_device: Create a graphics device file based on supplied file...

Description Usage Arguments Details Note Examples

View source: R/file_device.R

Description

General purpose graphics devices saved to files, where the file type is determined by the file name

Usage

1
file_device(filename, width = 5, height = 5, res = 600, ...)

Arguments

filename

the name of the output file. Can be a path but must contain a file extension at the end (e.g., "path/to/dir/file.png")

width

the width of the device, in inches. Defaults to 5

height

the height of the device, in inches. Defaults to 5

res

the resolution of the device, in pixels per inch. Defaults to 600. Has no effect if the extension is ".pdf" or ".eps"

...

optional arguments passed to the graphics device generating function (e.g., png)

Details

Accepted file extensions include:

Note

A call to dev.off is still required after the plotting code (see examples).

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
# use a png device
file_device("test.png")
hist(rnorm(1000), col = "grey")
dev.off()

# use a pdf device: can dump multiple plots in one file!
file_device("test.pdf")
hist(rnorm(1000), col = "grey")
boxplot(rnorm(1000), col = "grey")
dev.off()

## End(Not run)

bstaton1/StatonMisc documentation built on May 18, 2020, 12:06 a.m.