Description Usage Arguments Value See Also Examples
View source: R/computeHeatmap.R
Compute aggregate value(s) across two category classes represented by the
table columns dimension1
and dimension2
. Resulting data frame
represents 2dimensional multilayered matrix where each layer comprises
values from single aggregate. Category columns usually are of character,
temporal, or discrete types. Values are aggregates computed across
category columns utilizing SQL GROUP BY <dimension1>, <dimension2>
.
Aggregate formula may use any SQL expressions allowed with the GROUP BY
as defined above. Results are usually fed into createHeatmap
for heat map visualizations. If defined, parameter by
expands
grouping columns to be used with heat maps with faceting.
Result represents 2dimensional matrix with as many data layers as there were
aggregates computed. Additionally more layers defined with parameter by
support facets.
1 2 3 4 
channel 
connection object as returned by 
tableName 
table name 
dimension1 
name of the column for for heatmap x values. This value along with 
dimension2 
name of the column for for heatmap y values. This value along with 
aggregates 
vector with SQL aggregates to compute values for heat map. Aggregate may have optional
aliases like in 
aggregateFun 
deprecated. Use 
aggregateAlias 
deprecated. Use 
dimAsFactor 
logical indicates if dimensions and optional facet columns should be converted to factors. This is almost always necessary for heat maps. 
withMelt 
logical if TRUE then uses reshape2 
where 
specifies criteria to satisfy by the table rows before applying
computation. The creteria are expressed in the form of SQL predicates (inside

by 
vector of column names to group by one or more table columns for faceting or alike (optional). 
test 
logical: if TRUE show what would be done, only (similar to parameter 
Data frame representing 2dimensional multilayered matrix to use
with createHeatmap
. Matrix has as many layers as there are
aggregates computed. If by
defined, data frame contains multiple
matrices for each value(s) from the column(s) in by
(to support facets).
When withMelt TRUE
function melt
applies transforming data frame
and columns with aggregate values for easy casting: expands number of rows and
replaces all aggregate columns with two: variable
and value
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  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>")
hm = computeHeatmap(conn, "teams_enh", 'franchid', 'decadeid', 'avg(w) w',
where="decadeid >= 1950")
hm$decadeid = factor(hm$decadeid)
createHeatmap(hm, 'decadeid', 'franchid', 'w')
# with diverging color gradient
hm = computeHeatmap(conn, "teams_enh", 'franchid', 'decadeid', 'avg(wl) wl',
where="decadeid >= 1950")
hm$decadeid = factor(hm$decadeid)
createHeatmap(hm, 'decadeid', 'franchid', 'wl', divergingColourGradient = TRUE)
}

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.