分割表とモザイク プロットの向きに困っている人は他にいますか? 私は使用していませんが、JMP ユーザーの 1 人が、モザイク プロットと一致するように表の向きを反転したいと考えていました。X と Y を入れ替えると、表とモザイク プロットの両方が更新されることがわかりました。以下のスクリプトを参照して例を実行し、並べて比較してください。表示と参照を容易にするために、表の数字をモザイク プロットのセルに揃えたいようです。以前の議論は見つかりませんでした。分割表は変更できないようです。これは CrossTabBox であり、何も変更できません。以下のスクリプトの上部には回避策があり、x と y を入れ替えたときに作成された表のクローンを作成し、それをモザイク プロットに追加します。また、整列させるために値の順序付けを少し変更する必要がありました。JMP のウィッシュリストに追加します。私は JMP Discovery Summit 2018 で EA ラボと開発者と議論しました。
R 言語に関する投稿がいくつか見つかりました。そこでは dir() 引数を使用して水平と垂直を指定できますが、RStudio の「count」出力は方向に対して同じままです。
# R モザイク プロットの例 - 方向の変更
getwd()
従業員 <- read.csv("Products.csv", TRUE, sep = ",",
na.文字列 = TRUE)
count <- table(従業員$英語国地域名,
従業員$色)
カウント
mosaicplot(count, main = "国別モザイクプロット",
sub = "国別の製品カラー",
xlab = "色",
ylab = "国",
ラス = 1,
dir = c("h", "v"),
色 = "スカイブルー2",
ボーダー = "チョコレート")
// For a contingency table report, swap the x and y
// currently can swap the mosaic plot only
Names Default to Here(1);
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
myr = Contingency( Y( :Age ), X( :sex ) );
// Have to have a Contingency Analysis report open
// Can add test to make sure it is open in the future
myr = Current Report();
// taking apart CrossTabBox was easier using XML than JSL
mys = myr["Contingency Table"][CrossTabBox(1)] << Get XML;
// get current X role or rows of contingency table
start = Contains(mys,"<CROSSTABBOXROWSLABEL>")+22;
end = Contains(mys,"</CROSSTABBOXROWSLABEL>");
newY = Substr(mys,start,end-start);
// get current Y role or cols of contingency table
start = Contains(mys,"<CROSSTABBOXCOLSLABEL>")+22;
end = Contains(mys,"</CROSSTABBOXCOLSLABEL>");
newX = Substr(mys,start,end-start);
// Recreate same contingency table but with X and Y flipped
// also temporarily use Value Order to match the Mosaic Plot
myValueLabels = Reverse(Associative Array(Column(dt,newX)) << Get Keys);
Column(dt,newX) << Set Property("Value Ordering",myValueLabels);
tempCont = Contingency( Y(Column(dt,newY) ), X(Column(dt,newX) ), Contingency Table );
tempContr = tempCont << Report;
mycopy = tempContr["Contingency Table"][CrossTabBox(1)] << Clone Box;
tempCont << Close Window;
Column(dt,newX) << Delete Property("Value Ordering");
// remove the original contingency table and replace with transpose
myr["Contingency Table"][CrossTabBox(1)] << Delete;
myr["Contingency Table"] << Append(mycopy);
// show original side by side
obj = Contingency( Y( :Age ), X( :sex ) );
Report(obj)["Contingency Table"] << Set Title("Contingency Table - Current output");
myr["Contingency Table"] << Set Title("Contingency Table - Wish List for JMP16");