Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- JMP User Community
- :
- Discussions
- :
- Deleting specified rows

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Created:
Jul 12, 2019 7:28 AM
| Last Modified: Jul 12, 2019 9:29 AM
(1461 views)

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

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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;
```

2 REPLIES 2

Highlighted

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

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;
```

Highlighted
##

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Re: Deleting specified rows

This worked, thank you!

Article Labels

There are no labels assigned to this post.