Learn R Programming

visdat (version 0.0.4.9999)

vis_dat: Visualises a data.frame to tell you what it contains.

Description

vis_dat gives you an at-a-glance ggplot object of what is inside a dataframe. Cells are coloured according to what class they are and whether the values are missing. As vis_dat returns a ggplot object, it is very easy to customize and change labels, and customize the plot

Usage

vis_dat(x, sort_type = TRUE, palette = "default", flip = FALSE)

Arguments

x
a data.frame object
sort_type
logical TRUE/FALSE. When TRUE (default), it sorts by the type in the column to make it easier to see what is in the data
palette
character "default", "qual" or "cb_safe". "default" (the default) provides the stock ggplot scale for separating the colours. "qual" uses an experimental qualitative colour scheme for providing distinct colours for each Type. "cb_safe" is a set of colours that are appropriate for those with colourblindness. "qual" and "cb_safe" are drawn from http://colorbrewer2.org/.
flip
logical TRUE, will flip the axis labels to be on top, resembling a dataframe

Examples

Run this code

library(visdat)

vis_dat(airquality)

# flip the axis to look more like a dataframe
vis_dat(airquality, flip = TRUE)

# experimental colourblind safe pallete
vis_dat(airquality, palette = "cb_safe")

Run the code above in your browser using DataLab