cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
qspringleaf
Level III

How to use JMP script to generate a table with duplicate data

How to use JMP script to generate a table with duplicate data, list below...

kindly su

 

Before   After
NameShift   NameShift
JohnShiftA------>'JohnShiftA
KevinShiftB   KevinShiftB
TomShiftC   TomShiftC
TimShiftD   TimShiftD
LilyShiftE   LilyShiftE
JessicaShiftF   JessicaShiftF
     JohnShiftA
     KevinShiftB
     TomShiftC
     TimShiftD
     LilyShiftE
     JessicaShiftF
     JohnShiftA
     KevinShiftB
     TomShiftC
     TimShiftD
     LilyShiftE
     JessicaShiftF
     JohnShiftA
     KevinShiftB
     TomShiftC
     TimShiftD
     LilyShiftE
     JessicaShiftF
     JohnShiftA
     KevinShiftB
     TomShiftC
     TimShiftD
     LilyShiftE
     JessicaShiftF
2 ACCEPTED SOLUTIONS

Accepted Solutions
tom_abramov
Level V

Re: How to use JMP script to generate a table with duplicate data

Try this:

dt = Current Data Table();
Ntimes = 5;
for(i=1,i<=Ntimes,i++,
	dt << Concatenate (dt, Append to first table(1));
);

View solution in original post

Craige_Hales
Super User

Re: How to use JMP script to generate a table with duplicate data

Nice! if you want N copies rather than doubling the size N times, you can start with an empty table like this:

dt = Current Data Table();
Ntimes = 5;
dtnew = New Table();
For( i = 1, i <= Ntimes, i++,
	dtnew << Concatenate( dt, Append to first table( 1 ) )
);

The empty table is special when first created: it appears to have a column named "Column 1", but that column is a placeholder that will vanish if not used.

Doubling with Tom's answer is much faster if you need a lot of copies. 10 doubles in 0.02 sec or 1024 copies in 0.50 sec.

 @chungwei 

Craige

View solution in original post

2 REPLIES 2
tom_abramov
Level V

Re: How to use JMP script to generate a table with duplicate data

Try this:

dt = Current Data Table();
Ntimes = 5;
for(i=1,i<=Ntimes,i++,
	dt << Concatenate (dt, Append to first table(1));
);
Craige_Hales
Super User

Re: How to use JMP script to generate a table with duplicate data

Nice! if you want N copies rather than doubling the size N times, you can start with an empty table like this:

dt = Current Data Table();
Ntimes = 5;
dtnew = New Table();
For( i = 1, i <= Ntimes, i++,
	dtnew << Concatenate( dt, Append to first table( 1 ) )
);

The empty table is special when first created: it appears to have a column named "Column 1", but that column is a placeholder that will vanish if not used.

Doubling with Tom's answer is much faster if you need a lot of copies. 10 doubles in 0.02 sec or 1024 copies in 0.50 sec.

 @chungwei 

Craige