Learn R Programming

asciichartr (version 0.1.0)

asciiPlot: ASCII chart of vector. Generate an ascii chart for a series of numbers.

Description

asciiPlot returns a character string of a chart for given series.

Usage

asciiPlot(series, cfg = list())

Arguments

series

A numeric vector, missing data values in the series can be specified as a NA.

cfg

A named list with some options: height specifies the number of rows the graph should occupy. It can be used to scale down a graph with large data values. format specifies a C format string used to format the labels on the y-axis. The default value is " symbols provides a list of single characters to use for drawing the curve. offset changes what column will the y-axis be drawn. Default is 3. min and max will clamp the y-axis and all values.

Value

A character string

Examples

Run this code
# NOT RUN {
series <- c(1,2,3,4,4,3,2,1)
cat(asciiPlot(series))

series <- c(1,2,3,NA,4,3,NA,1)
cat(asciiPlot(series))

series <- c(1,2,3,4,NA,4,3,2,1)
cat(asciiPlot(series, list('min' = 0)))

# }
# NOT RUN {
cat(asciiPlot(c(NA, NA)))
# }

Run the code above in your browser using DataLab