cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
woongkim79
Level II

How to find and delete rows in a data table containing a text (or elements in a list)

I have a list containing a combinations of letters ... e.g A B C D...

Column1

A

B

C

D

AB

AC

AD

ABC

ABD

..... so forth or as a list e.g. mylist = {A, B, C, D, AB, AC, AD, ABC, ABD....}.

While it is possible to find those cells starting with "AB" using Edit-Search-Find from the table menu, it is strange I cannot find a way to do this using JSL script.

I would imagine something like:

loc (mylist,"AB?") for a list or

current data table << get rows where (Column 1 == "AB?") for a data table

...should work but they don't.

Can anyone suggest a way to locate these values using a wildcard (i.e. AB?) or other clever ways to find these items and delete them?

Thank you in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: How to find and delete rows in a data table containing a text (or elements in a list)

This is a perfect situation for using regular expressions.  For a table you can use the REGEX function:

dt = open("$sample_data/Car Physical Data.jmp");

ch_rows = dt << get rows where(regex(:Model, "^Ch") == "Ch");

That code snippet will find all rows beginning with the string "Ch".

View solution in original post

2 REPLIES 2
pmroz
Super User

Re: How to find and delete rows in a data table containing a text (or elements in a list)

This is a perfect situation for using regular expressions.  For a table you can use the REGEX function:

dt = open("$sample_data/Car Physical Data.jmp");

ch_rows = dt << get rows where(regex(:Model, "^Ch") == "Ch");

That code snippet will find all rows beginning with the string "Ch".

woongkim79
Level II

Re: How to find and delete rows in a data table containing a text (or elements in a list)

Beautiful!  Thank you so much PMroz.

Recommended Articles