Learn R Programming

toaster (version 0.5.5)

createClusterPairsPlot: Create cluster variable plot.

Description

Create cluster variable plot.

Usage

createClusterPairsPlot(km, include = NULL, except = NULL, baseSize = 12, baseFamily = "serif", title = "Cluster Variable Pairs", ticks = FALSE, defaultTheme = theme_tufte(base_size = baseSize, base_family = baseFamily, ticks = ticks), themeExtra = theme(), ...)

Arguments

km
an object of class "toakmeans" returned by computeKmeans.
include
a vector of column names to include. Plot never contains variables other than in the list. Plot would never include idAlias even if it is included explicitly.
except
a vector of column names to exclude. Plot never contains variables from the list.
baseSize
theme base font size.
baseFamily
theme base font family.
title
plot title.
ticks
logical Show axis ticks using default theme settings (see defaultTheme)?
defaultTheme
plot theme settings with default value theme_tufte. More themes are available here: ggtheme (by ggplot2) and ggthemes.
themeExtra
any additional theme settings that override default theme.
...
other parameters being suplied to geom's aes.

Value

ggplot object

Examples

Run this code
if(interactive()){
# initialize connection to Lahman baseball database in Aster 
conn = odbcDriverConnect(connection="driver={Aster ODBC Driver};
                         server=<dbhost>;port=2406;database=<dbname>;uid=<user>;pwd=<pw>")
                         
km = computeKmeans(conn, "batting", centers=5, iterMax = 25,
                   aggregates = c("COUNT(*) cnt", "AVG(g) avg_g", "AVG(r) avg_r", "AVG(h) avg_h"),
                   id="playerid || '-' || stint || '-' || teamid || '-' || yearid", 
                   include=c('g','r','h'), scaledTableName='kmeans_test_scaled', 
                   centroidTableName='kmeans_test_centroids',
                   where="yearid > 2000")
km = computeClusterSample(conn, km, 0.01)
createClusterPairsPlot(km, title="Batters Clustered by G, H, R", ticks=FALSE)
}

Run the code above in your browser using DataLab