CanvasXpress Data Wrangling
Explore and model data by grouping, sorting, clustering, and transforming.
Introduction to Data Wrangling
Data wrangling is a crucial step in any data analysis workflow, involving the process of cleaning, structuring, and enriching raw data into a more usable format. In CanvasXpress, this process is streamlined with a powerful set of functionalities that allow you to manipulate your data directly within the browser, without the need for server-side processing.
This section provides a comprehensive guide to the various data wrangling methods available in CanvasXpress, enabling you to prepare your datasets for effective visualization and analysis. These functions can be applied programmatically through the API or interactively via the user interface.
Consider the following dataset to showcase some of these methods.
Name | Weight | Height | Waist | Hip | Age | Gender | Excercise | Keith | 65.6 | 174 | 71.5 | 93.5 | 21 | Male | Low |
---|---|---|---|---|---|---|---|
Nina | 51.6 | 161 | 66.5 | 92.0 | 22 | Female | Moderate |
Freddy | 80.7 | 194 | 83.2 | 95.0 | 28 | Male | Moderate |
Tracey | 49.2 | 160 | 61.2 | 91.0 | 19 | Female | Moderate |
Isabelle | 55.2 | 173 | 66.5 | 90.3 | 32 | Female | Low |
Penny | 48.7 | 151 | 61.6 | 90.0 | 35 | Female | Intense |
Grouping Data
Grouping can be done through the CanvasXpress configuration
new CanvasXpress(targetId, data, {
graphType: "Boxplot",
// ... other configurations ...
groupingFactors: ["Gender"]
});
or a function call after the visualization has been rendered
var cX = new CanvasXpress(targetId, data, config);
cX.groupSamples(["Gender"]);
Facets
Facets can be done through the CanvasXpress configuration
new CanvasXpress(targetId, data, {
graphType: "Bar",
...,
segregateSamplesBy: ["Excercise"]
});
or a function call after the visualization has been rendered
var cX = new CanvasXpress(targetId, data, config);
cX.segregateSamples(["Excercise"]);
Sort Data
Sorting can be done through the CanvasXpress configuration
// Sort data by Age
new CanvasXpress(
targetId,
data, {
graphType: "Bar",
sortData: [['var', 'smp', 'Age']]
});
//Sort data by Height
new CanvasXpress(
targetId,
data, {
graphType: "Bar",
sortData: [['cat', 'smp', 'Height']]
});
or a function call after the visualization has been rendered
var cX = new CanvasXpress(targetId, data, config);
// Sort by Age
cX.modifySort(['var', 'smp', 'Age']);
// Sort by Height
cX.modifySort(['cat', 'smp', 'Height']);
Correlating Data
Data can be correlated to its meta-data
Correlation can be done through a function call
var cX = new CanvasXpress(targetId, data, config);
cX.correlateData(true, "Hip");
Histogram Data
Histograms can be created through the CanvasXpress configuration
new CanvasXpress(
targetId,
data, {
graphType: "Bar",
showHistogram: true
});
or a function call after the visualization has been rendered
var cX = new CanvasXpress(targetId, data, config);
cX.createHistogram();
Clustering Data
Cluster data can be done through the CanvasXpress configuration
new CanvasXpress(
targetId,
data, {
graphType: "Bar",
samplesClustered: true
});
or a function call after the visualization has been rendered
var cX = new CanvasXpress(targetId, data, config);
cX.clusterSamples();
Transform Data
Data transformation can be done through a funciton call
var cX = new CanvasXpress(targetId, data, config);
cX.transform("log2");
Transpose Data
Transposing data can be done through the CanvasXpress configuration
new CanvasXpress(
targetId,
data, {
graphType: "Bar",
transposeData: true
});
or a function call after the visualization has been rendered
var cX = new CanvasXpress(targetId, data, config);
cX.transpose();
Pivot Data
Pivot data can be done through a funciton call
var cX = new CanvasXpress(targetId, data, config);
cX.pivotX("Gender");