こんにちは、みんな、
ある計算に基づいて JMP テーブル (たとえば table-1) にいくつかの列を作成するスクリプトを書きました。 ここで、Table-1 の選択したいくつかの行と列を別の JMP テーブル (たとえば table-2) に移入したいと考えています。 2 番目のテーブルに選択した行と列を入力するのに助けが必要です。
ぜひご提案ください。
よろしくお願いします。
ディリップ
ここでは、あなたが求めていることを実行するためのいくつかの方法を示します。更新プラットフォームを使用する最初の方法は、セル間の更新よりもはるかに効率的ですが、どちらもうまく機能し、それぞれの手法を使用する場所があります。
Names Default To Here( 1 );
dt1 = Open( "$SAMPLE_DATA/big class.jmp" );
dt2 = Open( "$SAMPLE_DATA/big class families.jmp" );
// Add a new columns
dt1 << New Column( "Height, Weight ratio", formula( :weight / :height ) );
dt1 << New Column( "Age, Height ratio", formula( :height / :Age ) );
// Add the Height, Weight ratio to the dt2 data table, for only the
// females, using a simple subset and a join
dt1 << select where( :sex == "F" );
dtSubset = dt1 << subset(
private,
selected rows( 1 ),
columns( {"name", "Height, Weight ratio"} )
);
dt2 << Update( With( dtSubset ), Match Columns( :name = :name ) );
Close( dtSubset, nosave );
// Add the Age, Height ratio to the dt2 data table for only the
// 13 year olds, using cell by cell processing
dt2 << New Column( "Age, Height ratio" );
For( i = 1, i <= N Rows( dt1 ), i++,
If( dt1:age[i] == 13,
foundRow = dt2 << get rows where( dt1:name[i] == dt2:name & dt2:age == 13 );
If( N Rows( foundRow ) == 1,
theRow = foundRow[1];
dt2:Name( "Age, Height ratio" )[theRow] = dt1:Name( "Age, Height ratio" )[i];
);
)
);
また、他の方法も使用できます。利用可能なさまざまなオプションをよく理解するには、スクリプト ガイドを読むことをお勧めします。
ヘルプ==>書籍==>スクリプトガイド