forループを使用したデータフィルタの問題こんにちは、みんな
私は今データを除外するために直面している問題を抱えています。私はここで2つの問題を抱えています:
問題1 :どうやって@を文字に変換することができますか?スクリプトを実行するとエラーになるからです。
グループ(
:名前( "I_P2A .6 / .045 Avg @ ET")、
:名前( "I_N2A .3 / .045平均@ ET")、
:名前( "I_P2G_G_0.6 / 0.06平均@ ET")、
:名前( "I_P2HG_0.6 / 0.06平均@ ET")
)
Freq( "なし")、
重さ( "なし")
問題2: ループを使用したデータフィルタ
以下の4つのパラメータを1つの名前にまとめる(名前を宣言する)場合は、可能ですか。
私のデータセットでは、列名は次のようになっているからです。I_P2A .6 / .045 Avg @ ET
I_N2A .3 / .045平均@ ET
I_P2G_G_0.6 / 0.06平均@ ET
I_P2HG_0.6 / 0.06平均@ ET
それで、私の目的は、どのようにして4つの列を1つの名前にすることができるかということです。スクリプトを書くとき、宣言する変数名(4つのパラメーター)だけを書く必要があります。この変数名 一つの名前にまとめることは可能ですか?
dt = open("---------");
family_device = Data Table("--------") << Summary (Group(:Family Device), Freq("None"), Weight("None"));
parameter = Data Table("---------") << Summary(
Group(
:Name( "I_P2A .6/.045 Avg @ ET" ),
:Name( "I_N2A .3/.045 Avg @ ET" ),
:Name( "I_P2G_G_0.6/0.06 @ ET" ),
:Name( "I_P2HG_0.6/0.06 @ ET" )
),
Freq( "None" ),
Weight( "None" )
);
For(ifamily_device = 1, ifamily_device <= NRows(family_devices), ifamily_device++,
thisFamily_Device = family_devices : Family Device[ifamily_device];
For(iparameter = 1, iparameter <= Nrows(parameters), iparameter++,
thisParameter = parameters: (column name in dataset-how i convert all these 4 parameters into one group name?)[iparameter];
Group(
:Name( "I_P2A .6/.045 Avg @ ET" ),
:Name( "I_N2A .3/.045 Avg @ ET" ),
:Name( "I_P2G_G_0.6/0.06 Avg @ ET" ),
:Name( "I_P2HG_0.6/0.06 Avg @ ET" )
)
);
);ありがとう。
再:forループを使用したデータフィルタの問題
再:forループを使用したデータフィルタの問題私は絵を使うほうがいいと思う。
今私はS_GXを持っているとしましょう、そしてそれはパラメータI_P2A GSVT .6 / .045 AvgとI_N2A GSVT .3 / .045 Avgを使用します。しかし今、私は自分のデータセットから要約する必要があります、それはここで私が要約する必要があることを意味しますS_GXは私である2つのパラメータを使用します _P2A GSVT .6 / .045 AvgおよびI_N2A GSVT。3 / .045 Avg.etc ...
ありがとう
再:forループを使用したデータフィルタの問題やりたいことを明確に説明していないのが残念。
実際に私がやりたいことは、私は製品の種類に基づいて要約をしたいのです、例えば:今私は製品a、b、c、d、eを持ち、製品のそれぞれはそれ自身のパラメータリストを持ちます。6 / .045 Avg @ ET、I_N2A。3 / .045 Avg @ ET、I_P2G_G_0.6 / 0.06 Avg @ ET、I_P2HG_0.6 / 0.06 Avg @ ETなど だから今私は製品の要約を実行するためにフィルタまたは多分選択マッチングセルを使用したいですI_P2A .6 / .045 Avg @ ET、製品b使用I_N2A .3 / .045 Avg @ ETなど そして、各製品には複数のパラメーターがあります。それ以降は、結果を元にチャートを作成する必要があります。それから私のデータはかなり多いので、変動図を作成する前にデータをサブセット化する必要があります。そして今私の状態は、私が説明した要約を作成するためのスクリプトの実行方法がわからないということです。そして私もハードコーディングすることはできません。
それで、あなたは私にいくつか提案をしてもらえますか?
ありがとう再:forループを使用したデータフィルタの問題私はあなたが欲しいものを理解していないようです。 多分誰かが私がしているというより良い洞察力を持っています。
再:forループを使用したデータフィルタの問題私からの一つの質問:
あなたのコードによると、なぜカラム名を設定する必要があるのですか(カラム名を変更する)?私の場合は、(I_P2A .6 / .045 Avg @ ET、I_N2A。3 / .045 Avg @ ET、I_P2G_G_0.6 / 0.06 Avg @ ET、I_P2HG_0.6 / 0.06 Avg @のように) ET - 私はまだ私の列名としてそれを必要としています)、私の問題は私が下のコードで簡単に宣言することができるように4つの異なる列名を1つの名前にする方法です。
最後に、私は家族のデバイスとパラメータ(4つの異なる列名)に基づいて要約する必要があるからです。
ありがとう。再:forループを使用したデータフィルタの問題あなたのコードのエラーはJSLであまりにも多くのステップを実行することの徴候である、それであなたはどんな問題がどんな問題を引き起こしているかに関して混乱し始めています。 JSLは、実際の問題が何であるかを確認するためにコードをステップスルーするのに役立ついくつかの優れた点を提供します。 まず最初に、コードの任意のセクションを強調表示し、強調表示されたコードだけを実行する能力があります。 そして、単に変数の上にマウスを持って行き、それに対する最後の値が何であるかを見るための能力。 より正式な環境はJSL Debuggerを使用することです。これにより、コードを1行ずつステップ実行してロジックと計算を検証できます。
以下はあなたが提供したコードの評価です。 表示されるのは、コード内のエラーが、変数名に十分注意していないことからきているということです。
// This line of code has nothing to do with the script, so I have commented it out
//dt = open("---------");
// For testing purposes,a data table needs to be opened and setup with the columns used in the script
// Open the Big Class data table
dt = Open( "$SAMPLE_DATA\Big Class.jmp" );
// Now modify the data table to make it look like the script wants
// Delete the "name" column
dt << delete columns( "name" );
// The "sex" column will become the "Family Device" column
dt:sex << set name( "Family Device" );
// The "age", "weight", and "height" columns will be changed to three of the other columns required
dt:age << set name( "I_P2A .6/.045 Avg @ ET" );
dt:height << set name( "I_N2A .3/.045 Avg @ ET" );
dt:weight << set name( "I_P2G_G_0.6/0.06 @ ET" );
// Create the final column as a simple formula column
dt << New Column( "I_P2HG_0.6/0.06 @ ET", formula( Random Normal() ) );
// Now just remove the formula to make the values static(just a simple step to make the table clea)n
dt:Name( "I_P2HG_0.6/0.06 @ ET" ) << delete property( "Formula" );
// The sample data table is complete
// Now run the script
// The creation of the first summary data table....only the data table's name was substituted
// The summary works without error
family_device = Data Table( "Big Class" ) << Summary( Group( :Family Device ), Freq( "None" ), Weight( "None" ) );
// The creation of the second summary data table....once again only the data table name was changed
// There is no issue with the "@" being in the column names
// The summary works without error
parameter = Data Table( "Big Class" ) << Summary(
Group( :Name( "I_P2A .6/.045 Avg @ ET" ), :Name( "I_N2A .3/.045 Avg @ ET" ), :Name( "I_P2G_G_0.6/0.06 @ ET" ), :Name( "I_P2HG_0.6/0.06 @ ET" ) ),
Freq( "None" ),
Weight( "None" )
);
// There are issues here. The first one is that in the "NRows()" function, a variable by the
// name of "family_devices" is used, and there is not a variable by that name. The name of
// the variable is "family_device". When this code is run, that error is clearly listed in the Log
//For(ifamily_device = 1, ifamily_device <= NRows(family_devices), ifamily_device++,
For( ifamily_device = 1, ifamily_device <= N Rows( family_device ), ifamily_device++,
// Once again the reference to "family_device" is made
//thisFamily_Device = family_devices : Family Device[ifamily_device];
thisFamily_Device = family_device:Family Device[ifamily_device];
// For a third time, an invalid variable name has been specified. In this case, "Parameters"
// instead of "parameter"
//For(iparameter = 1, iparameter <= Nrows(parameters), iparameter++,
For( iparameter = 1, iparameter <= N Rows( parameter ), iparameter++,
// I am a bit confused on this one. First off, "parameters" instead of "parameter" is used, however
// the grouping question could be interpreted a couple of ways, so what I have done is to just
// concatenate the columns together
/*thisParameter = parameters: (column name in dataset-how i convert all these 4 parameters into one group name?)[iparameter];
Group(
:Name( "I_P2A .6/.045 Avg @ ET" ),
:Name( "I_N2A .3/.045 Avg @ ET" ),
:Name( "I_P2G_G_0.6/0.06 Avg @ ET" ),
:Name( "I_P2HG_0.6/0.06 Avg @ ET" )
)*/
thisParameter = Char( parameter:Name( "I_P2A .6/.045 Avg @ ET" )[iparameter] ) || Char( parameter:Name( "I_N2A .3/.045 Avg @ ET" )[iparameter] ) ||
Char( parameter:Name( "I_P2G_G_0.6/0.06 @ ET" )[iparameter] ) || Char( parameter:Name( "I_P2HG_0.6/0.06 @ ET" )[iparameter] );
show(thisFamily_Device, thisParameter );
);
);