Hola usuarios de JMP:
Me gustaría actualizar los nombres de las columnas de un archivo de configuración usando JSL y hacer gráficos que tendrán los nombres de las columnas actualizados en sus títulos y ejes. Estoy buscando ideas sobre cómo puedo hacer esto.
Estoy adjuntando mi código hasta ahora y tablas. Gracias por la ayuda.
Adjunté cómo me gustaría que se vea el gráfico final (deseado_Bivariante)
-Simón
Names Default To Here( 1 );
dt = Open( "table_1.jmp" );
dt1 = Open( "config_table.jmp" );
dt1 << New Column( "New Column", character, formula( Column_name || "_" || additional_name ) );
graph = dt << Bivariate( Y( :height ), X( :id ) );
Prueba esto:
Names Default To Here( 1 );
dt = Open( "table_1.jmp" );
dt1 = Open( "config_table.jmp" );
for(i = 1, i <= N Rows(dt1), i++,
x = Column(dt1, "Column_name")[i];
y = Column(dt1, "additional_name")[i];
Column(dt, i) << Set Name( x || "_" || y);
);
Aquí hay 2 enfoques diferentes del problema que no cambian el nombre real de las columnas, pero logran lo que está pidiendo.El primero crea columnas de transformación que tienen los nuevos nombres especificados para la ejecución del bivariante.Estas columnas solo existen para la ejecución bivariada.

El segundo ejemplo utiliza la propiedad de columna de unidades para las diferentes columnas de la tabla de datos.Las plataformas en JMP respetan la propiedad de la columna Unidades y la muestran como una adición al nombre real de la columna colocando el valor de Unidades en () después del nombre de la columna ..... (es decir, Altura (pies))

// This version of the script used Transform variables
// to temporarially change the name of the column just
// for the running of the Bivariate
Names Default To Here( 1 );
dt = Data Table( "table_1" );
dt1 = Data Table( "config_table" );
// Loop across the columns to run the Bivariate
For( i = 2, i <= N Cols( dt ), i++,
// Check to see if a column name change is specified
// in the config table
foundRow = dt1 << get rows where(
:Column_name == Column( dt, i ) << get name & dt1
:additional_name != ""
);
// If a column name change is found make the change
If( N Rows( foundRow ) > 0,
Eval(
Substitute(
Expr(
Bivariate(
Y(
Transform Column(
__trans__,
Formula( __col__ )
)
),
X( :id )
)
),
Expr( __trans__ ),
dt1:Column_name[foundRow[1]] || "_" || dt1
:additional_name[foundRow[1]],
Expr( __col__ ),
Parse( ":" || dt1:Column_name[foundRow[1]] )
)
),
// otherwise just run the bivariate
dt << Bivariate( Y( Column( i ) ), X( :id ) )
);
);
// This version of the script takes advantage of the Units
// column property. It will automatically add (unit value) to
// the display output, without actually changing the columns
// name
Names Default To Here( 1 );
dt = Data Table( "table_1" );
dt1 = Data Table( "config_table" );
// Add the Units Column Property to the columns in the
// original data table
For( i = 1, i <= N Cols( dt ), i++,
foundRow = dt1 << get rows where(
:Column_name == Column( dt, i ) << get name & dt1
:additional_name != ""
);
If( N Rows( foundRow ) > 0,
column( dt, i ) << set property("units", eval(dt1:additional_name[foundRow[1]]));
);
);
// Now run the normal bivariates
For( i = 2, i <= N Cols( dt ), i++,
dt << Bivariate( Y( Column( i ) ), X( :id ) )
);
Excelente. Gracias ThuongLe.