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
FlorenceJMP
Level I

Aplatir une table

Bonjour,

Est il possible dans JMP de joindre plusieurs colonnes en 1 seule ligne à partir d'un identifiant, autrement dit: passer du premier tableau au second?

Merci

NOMPrénomitem 1item 2item 3item 4        
frzegfzefezA12224a        
fezfezB35b        
fezfezC467c        
GRZGRxcsqD55d        
GZEGFEZE231e        
GZEGFEZF72f        
GZEQDG80g        
              
NOMPrénomitem 1-1item 2-1item 3-1item 4-1item 1-2item 2-2item 3-2item 4-2item 1-3item 2-3item 3-3item 4-3
frzegfzefezA12224a        
fezfezB35bC467c    
GRZGRxcsqD55d        
GZEGFEZE231eF72fG80g
GZEQDG80g        
2 REPLIES 2
hogi
Level XII

Re: Aplatir une table

in the second table, "G" shows up twice. with GFEZ and QD?

hogi
Level XII

Re: Aplatir une table

You could stack and then split the data.
To stack the columns, they have to have the same format. So maybe some additional step are necessary to align the formats and set them back to the original format.

 

dt = New Table( "demo",
	Add Rows( 7 ),
	Compress File When Saved( 1 ),
	New Column( "NAME",
		Character,
		Set Values( {"frzegfze", "he did", "he did", "GRZGR", "GZE", "GZE", "GZE"} )
	),
	New Column( "First name",
		Character,
		Set Values( {"he did", "he did", "he did", "xcsq", "GFEZ", "GFEZ", "QD"} )
	),
	New Column( "item 1",
		Character,
		Set Values( {"A", "B", "C", "D", "E", "F", "G"} )
	),
	New Column( "item 2",
		Character,
		Set Values( {"12", "3", "4", "5", "2", "7", "8"} )
	),
	New Column( "item 3",
		Character,
		Set Values( {"224", "5", "67", "5", "31", "2", "0"} )
	),
	New Column( "item 4",
		Character,
		Set Values( {"a", "b", "c", "d", "e", "f", "g"} )
	)
);

dt << New Column( "entry",
	Formula( Col Rank( Row(), :NAME, :First name ) ),
);

dtstacked = dt << Stack(
	columns( :item 1, :item 2, :item 3, :item 4 )
);


dtsplit = dtstacked <<
Split(
	Split By( :entry, :Label ),
	Split( :Data ),
	Group( :NAME, :First name )
);