名目資料按字母順序排列如果我有一列標稱數據,其中輸入可以多次出現,是否有辦法有一列輸出按輸入的字母順序排列?我可以走腳本路線,但我更喜歡一個簡單的列公式。
自動化和腳本編寫基礎資料分析與建模回覆:標稱資料依字母順序排列現在已經很晚了,所以我的解決方案可能不是最好的,但是使用大類數據表,這是我想出的公式
As Constant( Summarize( theLevels = by( :age ) ) );
Contains( theLevels, Char( :age ) );

回覆:標稱資料依字母順序排列在我們將密集排名添加到排名領帶和列排名函數之前,我會使用 txnelson 在簡單情況下展示的類似功能。有各種使用Col 統計函數的解決方案,但它們往往非常難以理解,因為您必須將多個解決方案組合在一起並相互內部(您可以從該願望清單項目的評論中找到一些解決方案) 。
回覆:標稱資料依字母順序排列另一方面 -
如此聰明的解決方法,我擔心需要一段時間才能實現密集排名。
謝謝吉姆!
回覆:標稱資料依字母順序排列
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
for(i=1, i<16, i++, dt<< Concatenate(dt,append to first table()));
wait(0);
show(nrows(dt));
Print("std rank");
t0 = hptime();
New Column( "std Rank",
Formula(
Col Rank( :height)
)
);
dt << run formulas();
show((hptime()-t0)/1000000);
Print("row_min rank median");
t0 = hptime();
New Column( "dense_Rank_ref1",
Formula(
Col Median(
Col Rank( If( Row() == Col Minimum( Row(), :height ), :height, . ) ),
:height
)
)
);
dt << run formulas();
show((hptime()-t0)/1000000);
print("summarize_contains");
t0 = hptime();
New Column( "dense rank_summarize_contains",
Formula(
As Constant( Summarize( theLevels = by( :height ) ) );
Contains( theLevels, Char( :height ) );
)
);
dt << run formulas();
show((hptime()-t0)/1000000);
print("row_min cumulative sum");
t0 = hptime();
print("- just works after sorting");
dt << Sort( By( :height ), Replace Table);
New Column( "dense_Rank_ref1",
Formula(
Col Cumulative Sum(If(Row() == Col Min(Row(), :height), 1,0))
)
);
dt << run formulas();
show((hptime()-t0)/1000000);
close(dt, nosave);回覆:標稱資料依字母順序排列更快的因素 2:透過總表繞道:

dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
for(i=1, i<16, i++, dt<< Concatenate(dt,append to first table()));
t0 = hptime();
dtsum = dt << Summary( Group( :height ),private);
dtsum << New Formula Column(
Operation( Category( "Distributional" ), "Rank" ),
Columns( :height )
);
dtsum << run formulas();
dt << Update(
With(dtsum),
Match Columns( :height = :height ),
Add Columns from Update Table( :"Rank[height]"n ),
Replace Columns in Main Table( None )
);
show((hptime() - t0)/1000000)
這種方法可以很容易地擴展到計算子集(groupBy)的密集排名。
回覆:標稱資料依字母順序排列當您建立總計表而不是使用 Summarize 時,可以使用@txnelson方法來計算子集的密集排名。
缺點:相當慢

看更多...names default to here(1);
Try(close(dt,nosave));
dt = Open( "$SAMPLE_DATA/Big Class Families.jmp" );
for(i=1, i<16, i++, dt<< Concatenate(dt,append to first table()));
t0 = hptime();
//dense rank - with groupby
dt << New Column( "dense rank_ grouped by",
Character,
formula (
local({tmp,myAge},
as constant (
dt = Current Data Table();
dtsum = dt << summary( Group( :age, :height ) );
//dtsum:age << set name(age2);
nr = N Rows( dt );
);
rw = row();
myage = dt:age[row()];
Eval (Eval Expr(myrows = dtsum << get rows where( dtsum:age == Expr(myAge)))); // <- use dtsum:age !!!
tmp = contains(dtsum[myrows,2], dt:height[rw]); // <- use dt:height !!!!
if(row()==nr, close(dtsum, noSave));
tmp
)));
show((hptime() - t0)/1000000)
回覆:標稱資料依字母順序排列最好將所有內容放入As Constant中,並在主要部分開始之前停止「公式」。
....超快。
....在小型 GUI 的幫助下:非常靈活

……並且透過允許永遠休眠的主命令:甚至動態:)
Names Default To Here( 1 );
Try(
dt = Current Data Table(),
Caption( "no dat table" );
Stop();
);
updateLBox = Function( {t},
(t << sib) << setitems( (t << topparent)[listboxbox( 1 )] << getselected )
);
nw = New Window( "rank unique entries",
<<TYPE></TYPE><EM>工作流程\BuildingBlocks\ColumnOperations\RankUnique_with_ByGroup.jmpflow</EM>
回覆:標稱資料依字母順序排列將
這人真聰明。如果按住 Ctrl 按鈕,我可以在「按組」中輸入多個值,但它僅對輸入數量的最後一個條目進行操作。我做錯了什麼嗎?