Crosstable {DataVisualizations} | R Documentation |
Crosstable plot
Description
Presents a heatmap with values and a cross table of given Data matrix of two features and a bin width or percentualized values. In this approach the bin width is fixes. A more general way to approach this is the kernel density estimation plot of PDEscatter
.
Usage
Crosstable(Data, xbins = seq(0, 100, 5), ybins = xbins,
NormalizationFactor = 1, PlotIt = TRUE, main='Cross Table',
PlotText=TRUE,TextDigits=0,TextProbs=c(0.05,0.95))
Arguments
Data |
[1:n,1:2] matrix of two features from which the cross table should be generated from |
xbins |
[1:k] start of k bins as a vector generated with |
ybins |
[1:k] start of k bins as a vector generated with |
NormalizationFactor |
Optional, Data feautures can be seen as regular time series, e.g. 1 measurement for a minute, in this case it is useful to normalize the output, e.g. to hours, then |
PlotIt |
Optional, Plots the heatmap if |
main |
In case of for |
PlotText |
In case of for |
TextDigits |
In case of for |
TextProbs |
In case of for |
Details
The interval in each bin is closed to the left and opened to the right. The cross table can be seen as a two-dimensional histogram. The idea to add histograms to the table is taken from [Charpentier. 2014].
Value
The cross table in invisible
mode which depicts the number of values (frequency) in an specific range with regard to two features.
The first feature is on the x-axis (left to right), and the second on y-axis (top to bottom) contrary to the plot where it is bottom to top.
Note
For non percentiled values the PlotText
part does not seem always to work, but I currently dont know why the text does not always overlap with the heatmap.
Author(s)
Michael Thrun
References
[Charpentier. 2014] Charpentier, Arthur, ed. Computational actuarial science with R. CRC Press, 2014.
See Also
Examples
data(ITS)
data(MTY)
#simple but not a good transformation
Data=(cbind(ITS/max(ITS),MTY/max(MTY)))*100
#choice for bins could be better
Crosstable(Data)