Learn R Programming

BrailleR (version 1.0.2)

sort.VIgraph: Sort VI.ggplot points list

Description

Allows the list of data points listed by VI.ggplot to be sorted by x or y values, ascending or descending. Currently only implemented for geom_points. This function is experimental and has not been extensively tested.

Usage

# S3 method for VIgraph
sort(x, decreasing = FALSE, by = "x", ...)

Value

Returns a new object of the same type as that returned by VI.ggplot, but with data re-ordered.

Arguments

x

object returned by VI.ggplot

decreasing

logical: should the sort be decreasing

by

value on which to sort, "x" or "y"

...

further arguments passed to base::sort

Author

Debra Warren and Paul Murrell

Examples

Run this code
if (require(ggplot2)) {
    sort(VI(qplot(x=1:5, y=c(2,5,1,4,3))), decreasing=TRUE, by="y")
}

Run the code above in your browser using DataLab