forループを使用せずに選択した行に一連の値を割り当てる方法は?こんにちは、みんな
get rows where()を使用して一連の行を取得し、以下のように、列bの下の行の値を別の列の下の同じ行に割り当てたいと考えました。
rows = dt <<行を取得しますwhere(column( "b")[] == "xxx");
column( "a")[rows] = column( "b")[rows];
しかし、それは機能しません。forループを使用せずに、選択した行に一連の値を割り当てる方法はありますか?
ありがとうございましたスクリプティングRe:forループを使用せずに、選択した行に一連の値を割り当てる方法は?これはあなたの問題を解決する1つの方法を示す例です
names default to here(1);
dt=open("$sample_data/big class.jmp");
// Create a new table with the same number of rows and a new
// character column called Gender
dtNew = New Table("New Table", add rows(nrows(dt)),
New Column("Gender",character)
);
// Assign to all rows in big class that are females, the value
// of "Female" to the same rows in New Table
dtNew:Gender[dt<<GET rows="" where=""></GET>Re:forループを使用せずに、選択した行に一連の値を割り当てる方法は?お返事をありがとうございます。
しかし、「特定の値」を割り当てる代わりに、forループなしで対応する行に「一連の値」を割り当てたいと思います。Re:forループを使用せずに、選択した行に一連の値を割り当てる方法は?他の人はこれを行うためのより効率的な方法を持っているかもしれませんが、ここに私の解決策があります
names default to here(1);
dt=open("$sample_data/big class.jmp");
// Create a new table with the same number of rows and a new
// character column called Gender
dtNew = New Table("New Table", add rows(nrows(dt)),
New Column("Gender",character)
);
// Assign to all rows in big class that are females, the value
// of "Female" to the same rows in New Table
values = dt:sex << get values;
dtNew:Gender << set values(values);
dtNew:Gender[dt<<GET rows="" where=""></GET>