Evidenzia le celle in base ai nomi delle colonne corrispondentiHo uno script che colora i valori minimi di giallo per ogni colonna Studentized in una tabella. Voglio evidenziare anche i valori adiacenti a questi valori nelle colonne non elaborate. Ad esempio, per Studentized Resid Rest Pulse, la cella adiacente a -2.321144119 nella colonna Rest Pulse, ovvero 44. Come posso farlo in jsl? Regex o match possono essere utili? Grazie
dt = current data table();
col = dt << get column names( string );
nc = N Items( col );
For( i = 1, i <= nc, i++,
Cols = Column(dt,i);
If( Contains( col[i], "Studentized Resid" ),
Min = dt << get rows where(as column(Cols)==(Col Min( Cols )));
Cols << color cells(Yellow, Min);
)
);
Sto cercando qualcosa del genere:

Ri: Evidenzia le celle in base ai nomi delle colonne corrispondenti@Jeff_Perkinson Ciao Jeff, ho già risolto la parte della sottostringa. Grazie comunque!!Ri: Evidenzia le celle in base ai nomi delle colonne corrispondenti@txnelson Intendi qualcosa come questo?
dt = Current Data Table();
// I changed the name from "col" to colNameList to keep from
// it being confused with the variable "Cols". It isn't
// confusing to JMP, just to me
colNameList = dt << get column names( string );
nc = N Items( colNameLIst );
// Loop across all columns
For( i = 1, i <= nc, i++,
// Create a variable that contains the "column" representation
// of the column name string value
Cols = Column( dt, i );
// If the column name starts with the string "Studentized Resid"
// and if so, then process
// I changed this because your Substr() function below indicates
// that the column with "Studentized Resid" will be at the beginning
If( Left( colNameList[i], 17 ) == "Studentized Resid",
// Find the minimum value for the column
MinValue = Col Min( Cols );
// Find all of the rows that have the minimum value. There
// could be more than one row with the minimum value, but this
// code only uses the first row
MinRows = dt << get rows where( As Column( Cols ) == MinValue );
// Theoretically, there should always be a matching value for this,
// but it is a good way to make sure the code will not fail. Also,
// if you ever want to deal with the posibility of more than one
// row matching the minimum, you would do it using this type of
// code structure
If( N Rows( MinRows ) > 0,
Cols << color cells( Yellow, MinRows ),
//column( Substr( colNameList[i], 19 ) ) << color cells( Yellow, MinRows )
);<BR /> column( Substr( colNameList[i], 19 ) ) << color cells( Yellow, MinRows )
)
);
L'ho fatto funzionare. Grazie mille per la guida..
Ri: Evidenzia le celle in base ai nomi delle colonne corrispondentiPotrei non capire il tuo problema.Se vuoi colorare le celle adiacenti ai valori minimi trovati per le colonne che contengono "Studentized ....." allora non devi far altro che farlo.Hai l'elenco dei nomi delle colonne......colNamesList e stai guardando attraverso le colonne.Quando trovi una colonna che contiene "Studentized......", trovi il nome dell'altra colonna che vuoi colorare e la riga che è il valore minimo.Ciò significa che conosci anche le celle che sono adiacenti alle celle che stai per colorare.....
column( Substr( colNameList[i], 19 ) ) << << color cells( Yellow, MinRows )<BR />
e se lo aggiungi subito dopo la colorazione della colonna "Studentizzato......", colorerà la cella appropriata
Ri: Evidenzia le celle in base ai nomi delle colonne corrispondentiÈ il Substr() funzione cosa ti manca?
resid_colname="Studentized Resid Rest Pulse";
//There are 19 characters in "Studentized Resid "
orig_colname = substr(resid_colname, 19);
show(orig_colname);
/*:
orig_colname = "Rest Pulse";
Ri: Evidenzia le celle in base ai nomi delle colonne corrispondenti@txnelson Ciao Jim, mi dispiace se mi manca qualcosa qui. Volevo anche evidenziare le colonne grezze adiacenti per ogni colonna studentizzata. Non sono in grado di farlo funzionare.
Ri: Evidenzia le celle in base ai nomi delle colonne corrispondentiEcco una semplice rielaborazione del tuo script.Funziona con i tuoi dati di esempio e dovrebbe funzionare con tutte le colonne che hai nella tabella dei dati
dt = Current Data Table();
// I changed the name from "col" to colNameList to keep from
// it being confused with the variable "Cols". It isn't
// confusing to JMP, just to me
colNameList = dt << get column names( string );
nc = N Items( colNameLIst );
// Loop across all columns
For( i = 1, i <= nc, i++,
// Create a variable that contains the "column" representation
// of the column name string value
Cols = Column( dt, i );
// If the column name starts with the string "Studentized Resid"
// and if so, then process
// I changed this because your Substr() function below indicates
// that the column with "Studentized Resid" will be at the beginning
If( Left( colNameList[i], 17 ) == "Studentized Resid",
// Find the minimum value for the column
MinValue = Col Min( Cols );
// Find all of the rows that have the minimum value. There
// could be more than one row with the minimum value, but this
// code only uses the first row
MinRows = dt << get rows where( As Column( Cols ) == MinValue );
// Theoretically, there should always be a matching value for this,
// but it is a good way to make sure the code will not fail. Also,
// if you ever want to deal with the posibility of more than one
// row matching the minimum, you would do it using this type of
// code structure
If( N Rows( MinRows ) > 0,
Cols << color cells( Yellow, MinRows )
);
// Output the requested values
Show( Substr( colNameList[i], 19 ), Cols[MinRows[1]] );
);
);
Ri: Evidenzia le celle in base ai nomi delle colonne corrispondentiNon sono ancora riuscito a capire come posso risolvere questo problema. Ho esaminato altre domande e la guida allo scripting per arrivare al mio script più recente.
Ecco il mio script più recente:
dt = current data table();
col = dt << get column names( string );
nc = N Items( col );
For( i = 1, i <= nc, i++,
Cols = Column(dt,i);
If( Contains( col[i], "Studentized Resid" ),
Min = dt << get rows where(as column(Cols)==(Col Min( Cols )));
Cols << color cells(Yellow, Min);
//show(Loc())
MinValue = Col Min(Cols);
ColValue = As List(Cols << Get Values);
show(Loc(ColValue,MinValue));
show(substr(col[i], 19,100));
)
);
Apprezzerei davvero se qualcuno potesse mostrarmi come posso continuare a utilizzare il metodo Substring per abbinare le colonne. Grazie in anticipo.
Ri: Evidenzia le celle in base ai nomi delle colonne corrispondentiSembra un approccio ragionevole.
Ri: Evidenzia le celle in base ai nomi delle colonne corrispondentiTutte le colonne grezze che hanno/corrispondono a colonne Studentized devono essere evidenziate. Stavo guardando la guida alla scrittura e ho cercato di lavorare con Regex Match e sottostringa per estrarre i nomi delle colonne senza "Studentized Resid". Anche qui tengo un elenco dei numeri di riga delle colonne evidenziate, sperando che aiuti a ottenere ciò che voglio. Qualsiasi approccio migliore sarà molto apprezzato.@txnelson
Ri: Evidenzia le celle in base ai nomi delle colonne corrispondentiCome immaginate l'inserimento di quali colonne devono essere elaborate?
Hai letto la Guida agli script?Ci sono molti esempi nel libro che ti daranno idee.
Aiuto==>Libri==>Guida allo scripting
Ri: Evidenzia le celle in base ai nomi delle colonne corrispondenti@pmroz grazie per la risposta, tuttavia, sto cercando una soluzione più dinamica a un problema del genere poiché potrei avere
a) Molte colonne
b) Diversi nomi di colonne in futuro.
Esistono funzioni JMP in grado di eseguire l'attività? Grazie
Ri: Evidenzia le celle in base ai nomi delle colonne corrispondentiEcco un modo con i nomi di colonna codificati:
dt = Current Data Table();
col = dt << get column names( string );
nc = N Items( col );
For( i = 1, i <= nc, i++,
Cols = Column( dt, i );
If( Contains( col[i], "Studentized Resid" ),
Min = dt << get rows where( As Column( Cols ) == (Col Min( Cols )) );
Cols << color cells( Yellow, Min );
:Rest Pulse << color cells( Yellow, Min );
:Run Pulse << color cells( Yellow, Min );
:Max Pulse << color cells( Yellow, Min );
);
);