官术网_书友最值得收藏!

  • Minitab Cookbook
  • Isaac Newton
  • 444字
  • 2021-07-16 12:29:18

Stacking several columns together

Minitab will prefer data set up as columns, and often, it is better to stack data together, using one column for all the results, and a second or third column to group the information together. Here, we will stack several numeric columns together into one column.

Getting ready

We want to stack several columns together to give a column of results and an indicator column to identify the group they belong to.

We require a worksheet with several columns of the same data type. In this example, we use data from the Party Membership of US Senators file. This data can be found at

http://mathforum.org/workshops/sum96/data.collections/datalibrary/data.set6.html.

This data is in the Excel file format. Download the file senators.xls. If you are copying and pasting data into Minitab, copy lines 3 to line 53. Alternatively, when following the instructions in the Opening an Excel file in Minitab recipe, set row 3 for the variable names.

The first column should be named State. Ensure that in Minitab the data appears as shown in the following screenshot:

Getting ready

How to do it…

The following instructions will stack the party columns together to create a single column for the number of US Senators:

  1. Go to the Data menu and select Stack; then click on Columns.
  2. Select the numeric columns, Democrats, Republicans, and Independents from the left-hand selection. They can be double-clicked on across into the section Stack the following columns:, alternatively select column 2 and drag down to column 4. Then click on the Select button to move the columns as a group.
    How to do it…
  3. Name the worksheet Stacked Data, from the New Worksheet section and click on OK.
  4. The worksheet will appear as in the following screenshot. As the columns will not be named from the stack command we need to rename them in the new worksheet. Column 1 Subscripts should be renamed to Party, and column 2 should be renamed to Senators.
    How to do it…

The preceding screenshot shows the stacked results that are created in a new worksheet. A useful tip here to avoid confusion while generating new worksheets, is to name the worksheet that will be generated in the stack column's dialog box.

How it works…

By default, the columns are created in a new worksheet, and an additional subscript column is created to differentiate the groups in the data. This can be deselected and will identify the stacked data by numeric values: 1 for the first column, 2 for the second, and so on. Alternatively, the data can be stacked into the same worksheet.

See also

  • The Stacking blocks of columns at the same time recipe
  • The Transposing the columns of a worksheet recipe
主站蜘蛛池模板: 垦利县| 隆林| 溆浦县| 哈尔滨市| 江油市| 黔西| 嘉峪关市| 伊宁市| 辽阳市| 凌源市| 固安县| 离岛区| 雅江县| 浠水县| 舒兰市| 连云港市| 乌苏市| 永城市| 新干县| 铁力市| 华宁县| 庆元县| 周至县| 凌海市| 美姑县| 格尔木市| 祁东县| 德阳市| 娄底市| 成安县| 扎赉特旗| 芮城县| 沾化县| 吉安市| 古浪县| 富平县| 竹溪县| 阳东县| 汨罗市| 胶州市| 寻乌县|