Learn R Programming

radiant (version 0.1.95)

visualize: Visualize data using ggplot2 http://docs.ggplot2.org/current/

Description

Visualize data using ggplot2 http://docs.ggplot2.org/current/

Usage

visualize(dataset, viz_xvar, viz_yvar = "none", data_filter = "", viz_type = "hist", viz_facet_row = ".", viz_facet_col = ".", viz_color = "none", viz_bins = 10, viz_smooth = 1, viz_check = "", viz_axes = "", shiny = FALSE)

Arguments

dataset
Dataset name (string). This can be a dataframe in the global environment or an element in an r_data list from Radiant
viz_xvar
One or more variables to display along the X-axis of the plot
viz_yvar
Variable to display along the Y-axis of the plot (default = "none")
data_filter
Expression used to filter the dataset. This should be a string (e.g., "price > 10000")
viz_type
Type of plot to create. One of Histogram ('hist'), Density ('density'), Scatter ('scatter'), Line ('line'), Bar ('bar'), or Box-plot ('box')
viz_facet_row
Create vertically arranged subplots for each level of the selected factor variable
viz_facet_col
Create horizontally arranged subplots for each level of the selected factor variable
viz_color
Adds color to a scatter plot to generate a heat map. For a line plot one line is created for each group and each is assigned a different colour
viz_bins
Number of bins used for a histogram (not accessible in Radiant)
viz_smooth
Adjust the flexibility of the loess line for scatter plots (not accessible in Radiant)
viz_check
Add a regression line ("line"), a loess line ("loess"), or jitter ("jitter") to a scatter plot
viz_axes
Flip the axes in a plot ("flip") or apply a log transformation (base e) to the y-axis ("log_y") or the x-axis ("log_x")
shiny
Did the function call originate inside a shiny app

Value

Generated plots

Details

See http://vnijs.github.io/radiant/base/visualize.html for an example in Radiant

Examples

Run this code
visualize("diamonds", "carat", "price", viz_type = "scatter", viz_check = "loess")
visualize("diamonds", "price:x", viz_type = "hist")
visualize("diamonds", "carat:x", viz_yvar = "price", viz_type = "scatter")

Run the code above in your browser using DataLab