Using JMP > Reshape Data > Split Columns > Examples of Splitting Columns
Publication date: 08/13/2020

Examples of Splitting Columns

This section contains two examples using the Split command:

In the first example, one column is split by a second column. See Split a Column: Basic Example.

The second example uses a Group variable. See Split a Column: Grouping Rows Example.

Split a Column: Basic Example

In the Popcorn.jmp data table, the data in the trial column shows that there are two trials, 1 and 2. In this example, split the yield column into two new columns: one for trial 1 and one for trial 2. Proceed as follows:

1. Select Help > Sample Data Library and open Popcorn.jmp.

2. Select Tables > Split.

3. Select the yield column and click Split Columns.

4. Select the trial column and click Split By.

5. Under Remaining columns, select Keep All.

The default is Drop All, which omits any columns that are not in the Split By, Split Columns, or Group fields. Selecting Keep All includes these columns in the new table.

6. (Optional) Type Yield column split by Trial column in the Output table name field.

7. Click OK.

A new data table is created (Figure 6.13). Notice the following:

The yield and trial columns are gone.

The data table has two new columns, named after the unique values (1 and 2) from the original trial column.

The values from the original yield column are now split into the new columns named 1 and 2.

The columns other than trial and yield are exactly the same as they were in the original table.

8. (Optional) Rename the new columns to give them meaningful names. For example, rename 1 to yield (trial 1) and rename 2 to yield (trial 2).

Figure 6.13 New Table Created By Splitting yield Column by trial Column 

Split a Column: Grouping Rows Example

The Drug Measurements.jmp sample data table contains measurements of three different drugs (a, b, and c) administered to 12 different subjects. You want to split the measurement into different columns, one for each drug type. You also want to group the measurements by subject.

1. Select Help > Sample Data Library and open Drug Measurements.jmp.

2. Select Tables > Split.

3. Select Drug Type and click Split By.

4. Select Measurement and click Split Columns.

Notice that the Subject variable contains unequal groups. Most of the subjects were given all three drugs, but subject 2 was given only one drug, and subjects 7 and 12 were given only two drugs. In this situation, to ensure that the correct measurements are associated with the correct subject, specify Subject as the Group variable.

5. Select Subject and click Group.

6. Click OK.

Figure 6.14 Drug Measurements.jmp Split by a Grouping Variable 

You can see that the appropriate missing values appear for subjects 2, 7, and 12.

Want more information? Have questions? Get answers in the JMP User Community (community.jmp.com).
.