cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
UserID16644
Level V

How to subset data with some headers in rows?

Hi, I have a big data which has headers inside some rows. I wanted to subset the data per header with its value. My data looks something like this:

 

Header 1Column 2Column 3Column 4
1111
1111
1111
Header 2Column 2Column 3Column 4
2222
2222
Header 3Column 2Column 3Column 4
3333
3333
3333

 

 

I need to subset the data per Header, so I should have Header 2 with 

Header 2Column 2Column 3Column 4
2222
2222

Header 3

Header 3Column 2Column 3Column 4
3333
3333
3333

 

I tried creating a Flag column, assign 1 to each header then subset. But the result is incorrect as it subset 1 and blank with Subset 1 with all the headers. This is what I created:

CSV << New Column ("Flag", Numeric);
r = CSV << getRowsWhere( Contains( :Header 1, "Header " ));
Column(CSV, "Flag")[r] = 1;

Please help

10 REPLIES 10
hogi
Level XII

Re: How to subset data with some headers in rows?

To create a column with a formula, right click on the column headers to add a new column:

hogi_2-1731484005648.png

 in the column menu, add a formula

hogi_3-1731484038875.png

and paste the formula from @jthi 's post.