cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
The Discovery Summit 2025 Call for Content is open! Submit an abstract today to present at our premier analytics conference.
Get the free JMP Student Edition for qualified students and instructors at degree granting institutions.
Choose Language Hide Translation Bar
View Original Published Thread

transpose list of lists (summarize()) without a for loop

vince_faller
Super User (Alumni)

Can anyone think of a way to transpose a list of lists like what comes from the following script so that each row is grouped together instead of by column. 

I know I can do it with a for loop but I'm wondering if there's anything better or less brute.  

 

Names default to here(1);
dt = open("$SAMPLE_DATA\Big Class.jmp");
summarize(dt, d = By(:age, :sex));

rows = nitems(d);
cols = nitems(d[1]);

show(rows, cols);

// rows = 2;
// cols = 12;

For this I want to change it from 2 lists of 12 to 12 lists of 2.  

 

Adding a few people that I think might either like this challenge or already have something. 

@pmroz,  @Justin_Chilton@gzmorgan0@msharp@ms

 

Vince Faller - Predictum
11 REPLIES 11
pmroz
Super User


Re: transpose list of lists (summarize()) without a for loop

Repeat: MS your repeat solution is very nice. :)

nikles
Level VI


Re: transpose list of lists (summarize()) without a for loop

I had the exact same question @vince_faller .  Thanks for asking.  I've posted a request for a feature like this to be added to the next version of JMP.  Let's see...

 

https://community.jmp.com/t5/JMP-Wish-List/Transpose-List-of-Lists-without-a-for-loop/idi-p/348968