cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Discovery is online this week, April 16 and 18. Join us for these exciting interactive sessions.
Choose Language Hide Translation Bar
kcorder
Level I

Deleting specified rows

Hey JMP community, I am extremely new to jmp/jsl (literally just started this week). I have a script that is supposed to select where certain values in a row are less than 3, and then delete those rows. This is the script I have to do so:

 

dt << select where( :Residual 1 <= 3 );
dt << delete rows;

 

The code correctly selects the rows I want it to, but upon deleting the rows they "update" themselves (I have a neural network model scripted into the lines before it... see below code).

 

 

// 1. Creates X1 column, and corresponding Y1 and Ystat columns
Close All( Data Tables, NoSave );
dt = New Table( "SampleRun 3",
	Add Rows( 100 ),
	New Script(
		"Ystat vs. X1",
		Graph Builder(
			Variables( X( :X1 ), Y( :Ystat ) ),
			Elements( Points( X, Y, Legend( 5 ) ) )
		)
	),
	New Column( "X1", 
		Formula( Random Integer( 50 ) )
	),
	New Column( "Y1", 
		Formula( If( :X1 < 25, 2 * :X1, 25 <= :X1 <= 30, 3 * :X1, 4 * :X1 ) )
	),
	New Column( "Ystat", 
		Formula( :Y1 )
	)
);
// 2. Creates predicted Ystat column, saves formulas into same data table (first iteration)
PredictedYstat = dt << Neural(
	Y( :Ystat ),
	X( :X1 ),
	Informative Missing( 0 ),
	Validation Method( "Holdback", 0.3333 ),
	Fit( NTanH( 3 ) )
);
PredictedYStat << Save Profile Formulas;

// 3. Adds residual column
dt << New Column( "Residual 1", Formula( Abs( :Predicted Ystat - :Ystat ) ) );
dt << select where( :Residual 1 >= 3 );
dt << delete rows;

 

 

I am able to select these rows and put them into a new table, but that is a last resort as it is inefficient. Any suggestions?

 

Thanks,

Kyle

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Deleting specified rows

If you want the Formulas to evaluate once and only once, one option would be to force the computation and then delete the formulas:

 

dt << Run Formulas;
Column(dt, "X1") << Delete Formula;
Column(dt, "Y1") << Delete Formula;
Column(dt, "Ystat") << Delete Formula;

View solution in original post

2 REPLIES 2

Re: Deleting specified rows

If you want the Formulas to evaluate once and only once, one option would be to force the computation and then delete the formulas:

 

dt << Run Formulas;
Column(dt, "X1") << Delete Formula;
Column(dt, "Y1") << Delete Formula;
Column(dt, "Ystat") << Delete Formula;
kcorder
Level I

Re: Deleting specified rows

This worked, thank you!