N Cols
N Cols using Delete Columns
Example 1
Summary: Runs data table preparation by opening a file, deleting unwanted columns, and retrieving column names.
Code:
dt = Open("data_table.jmp");
dt << Delete Columns( :Height, :Weight );
colnames = (dt << get column names)[2 :: N Cols( dt )];
Code Explanation:
- Open data table;
- Delete Height and Weight columns.
- Retrieve column names.
Example 2
Summary: Process of opening a data table, removing specified columns, and retrieving remaining column names.
Code:
dt = Open("data_table.jmp");
dt << Delete Columns( "height", "weight" );
colnames = (dt << get column names)[1 :: N Cols( dt )];
Code Explanation:
- Open data table;
- Remove height and weight columns.
- Retrieve remaining column names.
Example 3
Summary: Process of opening a data table, removing Height and Weight columns, and retrieving all column names.
Code:
dt = Open("data_table.jmp");
dt << Delete Columns( {:Height, :Weight} );
colnames = (dt << get column names)[1 :: N Cols( dt )];
Code Explanation:
- Open data table;
- Remove Height and Weight columns.
- Retrieve all column names.
Example 4
Summary: Deletes a column and retrieval of column names in a JMP data table, starting from index 4.
Code:
dt = Open("data_table.jmp");
dt << Delete Columns( :Height );
colnames = (dt << get column names)[4 :: N Cols( dt )];
Code Explanation:
- Open data table;
- Delete Height column.
- Retrieve column names starting from index 4.
N Cols using N Rows
Summary: Runs the reversal of rows and columns in an open data table, allowing for efficient data manipulation.
Code:
dt = Open("data_table.jmp");
dt[1 :: N Rows( dt ), 0] = dt[N Rows( dt ) :: 1, 0];
dt[0, 1 :: N Cols( dt )] = dt[0, N Cols( dt ) :: 1];
Code Explanation:
- Open data table.
- Reverse rows in table.
- Reverse columns in table.
Summary: Opens a data table and assigns the number of columns.
Code:
dt = Open("data_table.jmp");
noCol = N Cols( dt );
Code Explanation:
- Open data table.
- Assign number of columns.
N Cols using Random Normal
Summary: Selects random columns in a data table, utilizing the Random Normal function to determine column inclusion.
Code:
//select random cols rows in a data table
Names Default To Here (1);
dt = Open("data_table.jmp");
cols = {};
for each ({i}, 2::n cols(dt),
if (Random Normal() > 0,
Insert Into (cols, i)
)
);
dt << Select columns (cols);
Code Explanation:
- Set default names.
- Open data table.
- Initialize empty list cols.
- Loop through columns 2 to n.
- If random normal > 0.
- Insert column index into cols.
- End loop.
- Select columns in cols list.