OriginLab Corporation - Data Analysis and Graphing Software - 2D graphs, 3D graphs, Contour Plots, Statistical Charts, Data Exploration, Statistics, Curve Fitting, Signal Processing, and Peak Analysis     
 
Skip Navigation Links
All BooksExpand All Books
Origin HelpExpand Origin Help
Workbooks Worksheets and Worksheet ColumnsExpand Workbooks Worksheets and Worksheet Columns
Simple Manipulation of Worksheet DatasetsExpand Simple Manipulation of Worksheet Datasets
Stacking and Unstacking Worksheet ColumnsExpand Stacking and Unstacking Worksheet Columns

4.4.9.1 Stacking Worksheet Columns

The Stacking Worksheet Columns tool is for converting data from the raw mode into index mode. In the original dataset, samples belong to different groups is stored in different columns. After stacking, they will be in different rows in the same column, with an additional column in the worksheet providing the group information (the group from which the original sample is from).

To use this function:

  1. Create a new worksheet with input data.
  2. Highlight the selected data.
  3. Select Worksheet: Stack Columns from the Origin menu to open the wstackcol dialog box.

In fact, the wstackcol X-Function is called to start this function.

Stacking Worksheet Columns 1.png

Dialog Controls

Recalculate

Specify how to recalculate the results. See details in Recalculating Analysis Results.

Input Stack Column(s)

Specify the columns, from which the source data is. There should be at least two columns.

Group Identifier
Group Row(s)
Select the column label rows which contain the group information. With this information, the tool identifies the group to which the samples belong. If there are multiple rows selected, the selected order of the groups will show in the lower text box.
Options

The stacking options.

Include Other Column(s)
Specify whether to Include Other Column(s) in the output. If this check box is selected, you are allowed to pick the columns to be included.
Stack into Subgroups
Specify whether to stack the original samples into several subgroups. If this is not selected, all of the input samples will be stored in one column only. If this check box is selected, you are allowed to specify the number the subgroups, or the number of columns into which the samples are stacked.
Suppose there are 6 groups in the original data and you choose to stack them into two subgroups, the first, third, and fifth groups will be in the first subgroup while the rest will be in the second subgroup.
Stack by Rows
Specify whether to interlace samples from different groups.
Suppose there are two groups in the original dataset and this option is selected, the even rows in the output column will be samples that belong to the first group, while the odd rows will be samples from the second group. If this check box is not selected, the first n rows in the output column (n is the number of samples in the first group) will contain the samples from the first group while the rest rows will contain the samples from the second group.
Exclude Missing Rows
Specify whether to ignore rows that contain missing values in the source columns.
Output Settings
Group Column Long Name
Specify the long name for the group column. Options include:
  • <Group Row Header>
    The row header from which the group information is from, in other words, the selection of Group Row(s) (see above).
  • Group
    Groupn.
  • Class
    Classn.
Data Column Long Name
Enter the long name for the output data column. The long name will be enumerated.
Output Worksheet
Specify the worksheet for outputting the results.


How to Stack Columns

This function can stack columns, stack columns by row. It also allow including other columns and specifying the number of subgroups. So, combined with each other, there are several ways of stacking columns as following.

  • Stack
Stack values from several columns into several rows in a group.
Stack Columns.png
  • Stack by Row
Stack columns according to their rows instead of stacking one column underneath another. It interleaves the column's values.
Stack by Row.png
  • Stack and Include Other Column(s)
This kind of stacking will Include Other Column(s) from the original worksheet plus the newly stacked columns in new worksheet.
Include Non-stack Columns.png
  • Stack by Row and Include Other Column(s)
Stack columns according to the rows and include non-stack columns from the original worksheet.
Interleave Groups and Include Other Columns.png
  • Stack into Subgroups
Stack multiple columns into two or more groups.
Multiple Output Variable Groups.png
  • Stack by Rows and Stack into Subgroups
Stack multiple columns into two or more groups according to their rows.
Interleave Groups and Divided Groups.png
  • Stack into Subgroups and Include Other Column(s)
Stack multiple columns into two or more groups and include non-stack columns from the original worksheet.
Divide Groups and Include Other Columns.png
  • Stack by Rows, Stack into Subgroups and Include Other Column(s)
Stack multiple columns into two or more groups according to their rows and include non-stack columns from the original worksheet.
Interleave and Divide and Include Other Columns.png

Example

The following example will stack columns in a sample data file so that it is displayed in another form.

  1. Open the file \Samples\Statistics\Body.ogw.
    Wstackclos example 2.png
  2. Highlight column B, C and D in the Male worksheet and then select Worksheet: Stack Columns from the Origin menu to bring up the wstackcol dialog.
  3. Select Include Other Column(s) check-box and Stack by Rows check-box, other settings keep the default values.
    Wstackcol example 3.png
  4. Click OK to execute. You will get the following result:
    Wstackclos example 1.png
 

© OriginLab Corporation. All rights reserved.