plotup {brinton}R Documentation

Returns a ggplot object of a specific graphic explicitly called by name.

Description

In order to present the graphic, the user must define a dataset, at least one variable whitin this dataset and a compatible type of graphic. Future work will include graphics that can combine up to three variables.

Usage

plotup(data, vars, diagram, output = "plots pane", dir = tempdir())

Arguments

data

Data.frame. Default dataset to use for plot. If not already a data.frame, it should be first coerced to by [as.data.frame()].

vars

Character. A variable within the dataset.

diagram

Character. A specific graphic to be presented within the ones considered by the 'logical', 'ordered', 'factor', 'character', 'datetime' and 'numeric' arguments of the 'wideplot()' function.

output

Character. Type of output.

  • 'html': Creates and displays a html file with the specific graphic.

  • 'plots pane': Default output, a ggplot2 object in RStudio's plots pane.

  • 'console': Prints the code that produces the specific graphic.

dir

Directory in which the files are stored.

Value

This function returns a c('gg', 'ggplot') object, but if the 'output' argument is set to it 'html' or 'console', the function cause a side-effect: either creating and displaying a temporary html file, or printing the ggplot2 code to the console.

Examples

plotup(iris, "Petal.Width", "color heatmap")
plotup(iris, "Petal.Width", "color heatmap", output = "console")
if (interactive()) {
plotup(iris, "Petal.Width", "color heatmap", output = "html")
}

[Package brinton version 0.2.5 Index]