createClusterPlot: Create clusters' properties plot.

Description Usage Arguments Value See Also Examples

View source: R/plottingKmeans.R

Description

Create clusters' properties plot.

Usage

1
2
3
4
5
createClusterPlot(km, baseSize = 12, baseFamily = "serif",
  title = paste("Cluster Properties Plot"), xlab = "cluster",
  ylab = "value", border = TRUE, colorByCluster = TRUE, ticks = FALSE,
  defaultTheme = theme_tufte(base_size = baseSize, base_family = baseFamily,
  ticks = ticks), themeExtra = NULL)

Arguments

km

an object of class "toakmeans" returned by computeKmeans.

baseSize

theme base font size.

baseFamily

theme base font family.

title

plot title.

xlab

a label for the x axis, defaults to a description of x.

ylab

a label for the y axis, defaults to a description of y.

border

boolean indicates to use border around plotting area. In case of facets border is around each facet.

colorByCluster

logical: color corresponds to clusters or properties.

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.

Value

ggplot object

See Also

computeKmeans

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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")
createClusterPlot(km)
}

toaster documentation built on May 30, 2017, 3:51 a.m.