스크립팅을 처음 접했기 때문에이 스크립트를 생성하여 연구 그룹의 데이터 분석을 간소화 할 수있었습니다. 현재로서는 매우 사용자 친화적이지 않습니다 (스크립트로 이동하여 수동으로 대상 파일 경로를 삽입하고 'By1'및 'By1 변수 #'을 모두 대상 파일 경로에 정의 된 샘플 이름과 일치하도록 변경해야합니다 ( By1 = 대상 파일 경로), 수동으로 모든 데이터를 닫고 스크립트가 열리는 창을 표로 만들고보고합니다. 나는 스크립팅 인덱스를 통해 이러한 모든 장애물을 극복하고 스크립트를 간소화하는 방법을 가르치려고 노력하고 있지만 상대적으로 느리다.
내 목표는 운영자가 두 개의 프롬프트 창과 상호 작용하기 만하면됩니다. 하나는 열고 자하는 파일을 지정하도록 요청한 다음 하나는 최종 생성 된 데이터 테이블을 저장하는 동시에 스크립트에 의해 생성 된 모든 창을 닫는 것입니다.
모든 제안과 팁을 환영합니다. JSL에서 처음으로 스크립팅을 배우는 것은 매우 즐겁습니다!
Names Default To Here( 1 );
dt = Open( "Target File Path");
obj = dt << Tabulate(
Add Table(
Column Table(
Analysis Columns( :X1, :Y, :X2, :X3 ),
Statistics( Mean )
),
Row Table( Grouping Columns( :By1, :By2 ) )
)
);
obj << Make into Data Table;
nw = New Window ("Bivarate By2 Fit",
V List Box(
Fit Group(
Biv = Bivariate(
SendToByGroup( {:By1 == "By1 Variable 1"} ),
SendToByGroup( {:By1 == "By1 Variable 1"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 1", Platform Index( 2 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 1", Platform Index( 3 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 2"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 2", Platform Index( 2 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 2", Platform Index( 3 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 3"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 3", Platform Index( 2 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 3", Platform Index( 3 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 4"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 4", Platform Index( 2 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 4", Platform Index( 3 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 5"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 5", Platform Index( 2 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 5", Platform Index( 3 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 6"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 6", Platform Index( 2 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 6", Platform Index( 3 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 7"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 7", Platform Index( 2 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 7", Platform Index( 3 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 8"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 8", Platform Index( 2 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 8", Platform Index( 3 )},
Y( :Name( "Mean(X2)" ) )
),
X( :Name( "Mean(Y)" ) ),
Fit Line( {Line Color( {212, 73, 88} )} ),
By( :By1 )
)
)
)
);
Report ( Biv[1] ) ["Parameter Estimates"][Table Box(1)] << Make Combined Data Table;
dt = current data table ();
obj = dt << Split(
Split By( :Term ),
Split( :Y, :By1, :Estimate ),
Remaining Columns( Drop All ),
Sort by Column Property
);
New Column( "By2", Numeric, Continuous );
:"By2" << Format( "Percent", ,2 );
:"Estimate Mean(Y)" << Set Name ("Estimate Mean");
dt = current data table();
col =Column(dt, "By2");
col << Set Formula (:Estimate Mean() / :Estimate Intercept);
obj = dt << Tabulate(
Add Table(
Column Table(
Grouping Columns( :By1 Intercept ),
Analysis Columns( :By2 )
),
Row Table( Grouping Columns( :Y Intercept ) )
)
);
obj << Make into Data Table;
열기 및 닫기 기능을 알아 냈지만 열린 파일 By1 열의 데이터에서 Fit Group 섹션의 By1 변수를 자동으로 채우는 방법을 알아내는 데 여전히 문제가 있습니다.
제안 사항이 있습니까? 아래 업데이트 된 스크립트
dt1 = Open(
Pick File("Select JMP File",
"$Documents",
{"JMP Files|jmp", "All Files|*"},
1,
0
)
);
obj1 = dt1 << Tabulate(
Add Table(
Column Table(
Analysis Columns( :X1, :Y, :X2, :X3 ),
Statistics( Mean )
),
Row Table( Grouping Columns( :By1, :By2 ) )
)
);
obj1 << Make into Data Table;
dt2 = current data table();
Close (dt1);
nw1 = New Window ("Bivarate Fit",
V List Box(
Fit Group(
Biv = Bivariate(
SendToByGroup( {:By1 == "Series-1"} ),
SendToByGroup( {:By1 == "Series-1"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "Series-1", Platform Index( 2 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup(
{:By1 == "Series-1", Platform Index( 3 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 2"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 2", Platform Index( 2 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 2", Platform Index( 3 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 3"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 3", Platform Index( 2 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 3", Platform Index( 3 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 4"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 4", Platform Index( 2 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 4", Platform Index( 3 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 5"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 5", Platform Index( 2 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 5", Platform Index( 3 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 6"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 6", Platform Index( 2 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 6", Platform Index( 3 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 7"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 7", Platform Index( 2 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 7", Platform Index( 3 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 8"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 8", Platform Index( 2 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 8", Platform Index( 3 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 9"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 9", Platform Index( 2 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 9", Platform Index( 3 )},
Y( :Name( "Mean(X3)" ) )
),
SendToByGroup( {:By1 == "By1 Variable 10"}, Y( :Name( "Mean(X1)" ) ) ),
SendToByGroup(
{:By1 == "By1 Variable 10", Platform Index( 2 )},
Y( :Name( "Mean(X2)" ) )
),
SendToByGroup(
{:By1 == "By1 Variable 10", Platform Index( 3 )},
Y( :Name( "Mean(X3)" ) )
),
X( :Name( "Mean(Y)" ) ),
Fit Line( {Line Color( {212, 73, 88} )} ),
By( :By1 )
)
)
)
);
Report ( Biv[1] ) ["Parameter Estimates"][Table Box(1)] << Make Combined Data Table;
dt3 = current data table ();
obj2 = dt3 << Split(
Split By( :Term ),
Split( :Y, :By1, :Estimate ),
Remaining Columns( Drop All ),
Sort by Column Property
);
New Column( "By2", Numeric, Continuous );
:"By2" << Format( "Percent", ,2 );
:"Estimate Mean(Y)" << Set Name ("Estimate Mean");
Close (dt3);
dt4 = current data table();
col =Column(dt4, "By2");
col << Set Formula (:Estimate Mean() / :Estimate Intercept);
obj3 = dt4 << Tabulate(
Add Table(
Column Table(
Grouping Columns( :By1 Intercept ),
Analysis Columns( :By2 )
),
Row Table( Grouping Columns( :Y Intercept ) )
)
);
obj 3 << Make Into Data Table;
Close (dt4);
dt = current data table();
If( dt << Save( "" ),
Write( "\!nsaved to " || (dt << GetPath) ),
Write( "\!nsave canceled" )
);