cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • 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
MathStatChem
Level VII

Question: how to use Recode to remove carriage returns

One thing I noticed in JMP 16 (that is an improvement over previous versions) is that if you import data from Excel and an individual cell in the Excel worksheet has a carriage return in the cell, JMP now imports that entire cell and does not interpret that as an "end of record" and force a new row ---> Yay!  I've asked for that for a long time and it is great to see that change.

 

But now I face the issue of getting rid of the carriage return after I import the data.  I would like to use Recode (Cols > Recode) to do this, but I don't see a direct way to do this.  Perhaps using a Regex in in the Replace String approach would work?  Is there a good way to do this?  

1 REPLY 1
txnelson
Super User

Re: Question: how to use Recode to remove carriage returns

\!r is the escape character that parses to a carriage return. Given the embedded carriage return in the below data table

apic.PNG

The following JSL recognizes and removes it

Names Default To Here( 1 );
dt = current data tahle() );
dt << Begin Data Update;
col1 = dt << New Column( dt:Column 1 );
col1 << Set Name( "Column 1 2" );
dt << Move Selected Columns( {col1}, after( dt:Column 1 ) );
dt << Recode Column(
	dt:Column 1,
	{Map Value( _rcOrig, {"myval\!rbig", "myvalbig"}, Unmatched( _rcNow ) )},
	Update Properties( 1 ),
	Target Column( col1 )
);
dt << End Data Update;
Jim

Recommended Articles