Ignorare le righe "escluse"Ciao,
Sto ancora cercando di superare la "gobba" di JSL, quindi perdona la domanda fondamentale.
Il problema:
- Ho una tabella di esempio che contiene set di dati per tre repliche con suffisso di esempio a1, a2 e a3.
- A volte, uno dei replicati deve essere impostato sullo stato "Escluso" (l'esempio sotto è a2)
- Sto scrivendo uno script batch che aprirà una tabella e applicherà i calcoli solo ai set che non sono stati esclusi.
- Tuttavia, non sono ancora lì con il mio tentativo (mostrato di seguito) poiché i dati di tutti e tre sono ancora in fase di considerazione.
- Mi sembra che una dichiarazione "e" potrebbe essere necessaria per identificare le righe non escluse, quindi applicare la ricerca dei suffissi.
Qualsiasi input, sarebbe molto riconoscente.
Grazie Neil
states = Current Data Table() << Get Row States();
For( i = 1, i <= N Rows( states ), i++,
rs = As Row State( states[i] );
if (Excluded(rs)==0,
a1 = dt << Get Rows Where(Contains(:Sample,"a1"));
a2 = dt << Get Rows Where(Contains(:Sample,"a2"));
a3 = dt << Get Rows Where(Contains(:Sample,"a3"));
);
)
Tabella datiRi: ignorare le righe "escluse"Sembra che tu stia iterando sull'elenco delle righe escluse ma poi facendo la stessa analisi ogni volta, che in realtà non fa riferimento all'elenco delle righe escluse da nessuna parte.Ecco un modo che potrebbe risolvere il tuo problema, che ottiene righe corrispondenti e righe escluse e quindi rimuove semplicemente le righe escluse dall'elenco.
Names default to here(1);
//Make a sample dataset with some excluded rows
dt = Open("$Sample_data/iris.jmp");
excluded rows to set = [ 4, 9, 52 ];
dt << Select Rows( excluded rows to set );
dt << Exclude(1);
//Find all matching rows and load in associative array, useful for Remove From function later
species matches = associative array(dt << Get Rows Where(:Species == "setosa"));
//get excluded rows
excluded rows = dt << get excluded rows();
//remove excluded rows from the list of rows matching the species
Remove From (species matches, excluded rows);
//get the matching rows as a list
speciesmatches << get keys;Ri: ignorare le righe "escluse"ih,
Molte grazie per il contributo. Sono ancora un po 'un principiante, ma ho provato il concetto di array associativo. Il codice viene mostrato e funzionerà fino a "Ottieni chiavi". Tuttavia, non sono ancora sicuro di come ottenere le informazioni di cui ho bisogno da "accoppiamenti specie" per effettuare i calcoli necessari (ultime 6 righe elencate). Ho scattato un'immagine di una tabella tipica che conterrebbe set esclusi.
Neil
dt = Open( path );
// Find row that were excluded and load into list
Exc_row = dt << Get Excluded Rows;
dt << Select Rows( Exc_row );
dt << Exclude(1);
//Find all matching rows and load in associative array, useful for Remove From function later
species matches = associative array(dt << Get Rows Where(Contains(:Sample,"a1") |Contains(:Sample,"a2") |Contains(:Sample,"a3")));
//get excluded rows
Exc_row = dt << get excluded rows();
//remove excluded rows from the list of rows matching the species
Remove From (species matches, Exc_row);
//get the matching rows as a list
speciesmatches << get keys;
// What needs to be done to get mean of three (or 2 sets in the case of exclusion see table image)
a1 = dt << Get Rows Where(Contains(:Sample,"a1"));
a2 = dt << Get Rows Where(Contains(:Sample,"a2"));
a3 = dt << Get Rows Where(Contains(:Sample,"a3"));<BR />
c1 = Column("Image A pore area (%)");
mean1 = Mean(c1[a1[1]], c1[a2[1]], c1[a3[1]]);
Ri: ignorare le righe "escluse"Ecco uno script aggiornato che passa attraverso ogni specie nella tabella dei dati dell'iride e calcola la media per le righe che corrispondono a tali criteri.Detto questo, ora che capisco meglio cosa stai facendo, probabilmente lo farei in modo diverso e utilizzerei la tabulazione per trovare invece quei valori.
Names default to here(1);
//Make a sample dataset with some excluded rows
dt = Open("$Sample_data/iris.jmp");
excluded rows to set = [ 4, 9, 52 ];
dt << Select Rows( excluded rows to set );
dt << Exclude(1);
species list = {"setosa", "versicolor", "virginica"};
//For each species
for(s=1, s<= n items (species list), s++,
//Find all matching rows and load in associative array, useful for Remove From function later
species matches = associative array(dt << Get Rows Where(:Species == species list[s]));
//get excluded rows
excluded rows = dt << get excluded rows();
//remove excluded rows from the list of rows matching the species
Remove From (species matches, excluded rows);
//get the matching rows as a list, use that to find which rows to average
mn = mean( :Sepal length[speciesmatches << get keys] );
//output averages to the log
write(species list[s] || " mean = " || char(mn) || "\!n")
);
Opzione utilizzando tabulate:
Names default to here(1);
//Make a sample dataset with some excluded rows
dt = Open("$Sample_data/iris.jmp");
excluded rows to set = [ 4, 9, 52 ];
dt << Select Rows( excluded rows to set );
dt << Exclude(1);
//New column with the check for each value
New Column("Species_", Character, "Nominal", Formula(If(Contains(:Species, "se"), "se", Contains(:Species, "ve"), "ve", Contains(:Species, "vi"), "vi")));
//tabulate to find averages - script copied from 'source' of data table after selecting
//'make into data table' from tabulate platform, then inserted dt reference
dtTab = (dt << Tabulate(
Set Format( Mean( :Sepal length( 10, 4 ) ) ),
Add Table(
Column Table( Analysis Columns( :Sepal length ), Statistics( Mean ) ),
Row Table( Grouping Columns( :Species_ ) )
)
)) << Make Into Data Table;
//Now get values from the table
dtTab:"Mean(Sepal length)"n[dtTab << Get Rows Where(:Species_ == "se")];Ri: ignorare le righe "escluse"Grazie molto!
Proverò a vedere come va.
L'intento originale era semplicemente quello di prendere la porosità da una riga per ogni set (a1, a2 e a3) e ottenere la media. La porosità è la stessa per ogni replica, ma non è stato possibile trovare un modo più semplice per estrarre solo 3 punti distinti e la media.
Grazie ancora per il contributo.
Neil
Ri: ignorare le righe "escluse"Sicuramente dai un'occhiata sia alla piattaforma tabulate che alla funzione di riepilogo JSL, penso che entrambe possano ottenere la tua risposta abbastanza rapidamente.