for 루프를 사용하여 데이터 필터 문제안녕, 모두
이제 데이터를 필터링하는 데 문제가 있습니다. 여기에 2 가지 문제가 있습니다.
문제 1 : @ 문자로 변환 할 수있는 방법 ?? 스크립트를 실행하면 오류가 발생합니다.
그룹(
: 이름 ( "I_P2A .6 / .045 평균 @ ET"),
: 이름 ( "I_N2A .3 / .045 Avg @ ET"),
: 이름 ( "I_P2G_G_0.6 / 0.06 평균 ET"),
: 이름 ( "I_P2HG_0.6 / 0.06 평균 ET")
),
Freq ( "없음"),
무게 ( "없음")
문제 2 : 루프를 사용하여 데이터 필터.
아래 4 개의 매개 변수를 하나의 이름 (선언 이름)으로 그룹화 할 수 있습니까?
내 데이터 세트에서 열 이름은 다음과 같습니다. 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 개의 칼럼을 하나의 이름으로 만들 수 있느냐이다. 왜냐하면 스크립트를 작성할 때 필자가 선언 한 변수 이름 (4 개 매개 변수) 만 작성하면된다. 그러면이 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" )
)
);
);감사.
Re : for 루프를 사용하여 데이터 필터 문제
Re : for 루프를 사용하여 데이터 필터 문제나는 아마도 그 그림을 더 잘 사용할 것이라고 생각한다.
이제 내가 S_GX를 가지고 있고 매개 변수 I_P2A GSVT .6 / .045 Avg 및 I_N2A GSVT .3 / .045 Avg. 하지만 지금은 내가 내 데이터 집합에서 요약해야, 여기에 내가 요약해야 S_GX는 내가 _P2A GSVT .6 / .045 평균 및 I_N2A GSVT .3 / .045 평균 ...
감사
Re : for 루프를 사용하여 데이터 필터 문제내가 뭘하고 싶은지 명확하게 설명하지 못해 미안해.
실제로 내가하고 싶은 것은, 예를 들어, 제품 유형에 따라 요약을하고 싶습니다. 이제는 제품 a, b, c, d, e가 있고 각 제품에는 고유 한 매개 변수 목록이 있습니다 (예 : 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 등 그래서 지금은 필터를 사용하거나 어쩌면 제품의 사용 요약 I_P2A .6 / .045 Avg @ ET, 제품 B 사용 I_N2A .3 / .045 Avg @ ET 등을 수행하기 위해 셀을 선택하여 선택하고 싶습니다. 각 제품에는 둘 이상의 매개 변수가 있습니다. 그 이후로 나는 결과를 바탕으로 차트를 만들 필요가 있기 때문에. 내 데이터가 꽤 많이 있기 때문에 변동성 차트를 작성하기 전에 데이터를 하위 집합으로 만들어야합니다. 이제는 내 상태가 설명하기 위해 스크립트를 수행하는 방법을 알지 못합니다. 그리고 또한 하드 코딩도 할 수 없습니다.
그럼, 나에게 제안을 좀 해줄 수 있니?
감사Re : for 루프를 사용하여 데이터 필터 문제나는 네가 원하는 것을 이해하지 못하는 것 같다. 어쩌면 누군가가 내가하는 통찰력이 더 좋을 수도 있습니다.
Re : 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 개의 다른 컬럼 이름을 하나의 이름으로 그룹화하는 방법이다.
마지막으로, 가족 장치 및 매개 변수 (4 개의 다른 열 이름)를 기반으로 요약을 수행해야합니다.
감사.Re : for 루프를 사용하여 데이터 필터 문제코드의 오류는 JSL에서 너무 많은 단계를 실행하는 현상이므로 어떤 문제로 인해 어떤 문제가 발생하는지 혼란 스러울 수 있습니다. JSL은 코드를 단계별로 실행하여 실제 문제가 무엇인지 파악하는 데 도움이되는 몇 가지 유용한 정보를 제공합니다. 첫 번째는 코드 섹션을 강조 표시하고 강조 표시된 코드 만 실행하는 방법입니다. 그리고 변수 위에 마우스를 올려 놓고 마지막 값이 무엇인지 확인하십시오. 보다 공식적인 환경은 JSL 디버거를 사용하는 것입니다. JSL 디버거는 로직 및 계산의 유효성을 검사하기 위해 코드를 한 줄씩 단계별로 설명합니다.
다음은 제공 한 코드에 대한 평가입니다. 여러분이 보게 될 것은 코드의 오류가 변수 이름에 충분히주의를 기울이지 않는다는 것입니다.
// 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 );
);
);