cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
HenningWeiss
Level II

Renaming columns by position

Dear JMP Community,

 

I would like to rename a column/columns by position. I am creating a subset of a dataset and each time I run the code it counts up some column names. This makes it cumbersome to use this subset in subsequent code because the column names are always different.

 

dt is my big dataset

 

 

dt << select where( :ScreenCaption == "XYZ" ); //mark the rows in which ScreenCaption == "XYZ"
dt2 = dt << Subset( Output Table( "Subset" ), SelectedRows( 1 ), SelectedColumns( 0 ) ); //create the subset using marked rows

dt3 = dt2 << summary(
    Group( :Lot ),
    Mean( :Value ),
    Std Dev( :Value ),
    statistics column name format( "column" )
); // intermediate data table dt3 to calc statistical values
dt_joined = dt2 << join( with( dt3 ), by Matching columns( :Lot ) ); // join both intermediate data tables together

 

 

its in the dt_joined where the column name always changes due to taking in data from the Subset table.

I would like to then access dt_joined and change column name of column, lets say 2, to be a fixed name, to better access it subsequently.

 

Does anyone have an idea. Maybe I am also overcomplicating things I have the feeling. 

 

Best, Henning

1 ACCEPTED SOLUTION

Accepted Solutions
HenningWeiss
Level II

Re: Renaming columns by position

I found something that goes into the direction what I am looking for:

 

col = Column( 2 );
col << Set Name( "Lot" );

 

found here: https://www.jmp.com/support/help/en/15.1/index.shtml#page/jmp/column-attributes.shtml

 

I find it confusing though, why it does not take a syntax like datable:column(position). This way the code only accesses the last opened data table, which forces me to have that open and is unprecise when working with multiple tables.

Anywho, case closed for now.

View solution in original post

1 REPLY 1
HenningWeiss
Level II

Re: Renaming columns by position

I found something that goes into the direction what I am looking for:

 

col = Column( 2 );
col << Set Name( "Lot" );

 

found here: https://www.jmp.com/support/help/en/15.1/index.shtml#page/jmp/column-attributes.shtml

 

I find it confusing though, why it does not take a syntax like datable:column(position). This way the code only accesses the last opened data table, which forces me to have that open and is unprecise when working with multiple tables.

Anywho, case closed for now.