VI {BrailleR} | R Documentation |
Extract information from a graphical object
Description
A method that extracts the most relevant information from a graphical object (or implied set of graphical objects) and display the interpreted results in text or HTML form.
The method includes representations of summary methods that are more suitable for blind users. For example, the method for a data.frame uses a single line for each variable instead of the normal column layout used by the summary
method.
Usage
VI(x, Describe=FALSE, ...)
## S3 method for class 'histogram'
VI(x, Describe=FALSE, ...)
## S3 method for class 'aov'
VI(x, Describe=FALSE, ...)
## S3 method for class 'htest'
VI(x, Describe=FALSE, digits = getOption("digits"), ...)
## S3 method for class 'lm'
VI(x, Describe=FALSE, ...)
## S3 method for class 'ggplot'
VI(x, Describe=FALSE, threshold=10,
template=system.file("whisker/VIdefault.txt", package="BrailleR"),
...)
Arguments
x |
any R object |
Describe |
Should the |
digits |
number of decimal places to show |
threshold |
Only for ggplot. Maximum number of data items that should be individually listed in the output. |
template |
Only for ggplot. Template file, in mustache format, to be used in creating the text |
... |
other arguments, currently ignored |
Details
VI() is intended to extract the specific details for the particular graph or output.
It will provide the information as a printout to the console/terminal window.
Value
Nothing is returned when working with most of the functions functionality.
The VI.lm()
method is the first to move away from this idea and use a process that builds on the UniDesc()
function. In this case, the method creates an R markdown file and compiles it into HTML. The HTML document is opened if the R session is interactive.
VI.ggplot
returns a structure containing a hierarchical representation of the graph as well as the text description as a character vector. When run interactively, the text
description is printed.
Note
The VI.lm
method fails if you use the one line VI(lm(...))
even if the model is named using VI(Model1 <- lm(...))
. It does work if two explicit commands are used. For example Model1 = lm(...)
followed by VI(Model1)
.
The ggplot2 package contains many layers and not all of them have a VI output yet. However most of the commonly used ones do. Regardless the VI output should be considered experimental with some results being potenitally misleading.
Author(s)
A. Jonathan R. Godfrey, Debra Warren, Sophie Banks, Tony Hirst, Timothy P. Bilton and James A. Thompson
Examples
# Base R
RandomX=rnorm(500)
PlottedFig=hist(RandomX)
VI(PlottedFig)
# ggplot
if(require(ggplot2)){
ggplot(economics_long, aes(date, value01, colour = variable)) +
geom_line() +
ggtitle('dummy title')
}