我們正在生成一個腳本,用於根據用戶選擇的3D圖形方向自動生成2D XY坐標列。該腳本將調用R代碼來執行計算,但需要向R提供XYZ列數據和旋轉設置。
從保存的散點圖3D腳本中,我們可以看到XYZ列名稱(zue1 ...)和旋轉設置(-8 ....)。我們需要jsl代碼來選擇這些列並導出一個csv文件。並選擇和導出旋轉設置值的代碼。
任何意見,將不勝感激。
散點圖3D (
Y(:zue1,:zue2,:zue3),
框架3D (
設置抓握手柄( 0 ),
設定旋轉度(- 8.15592033195416 , 47.3040538060599 , 75.4291344975828 )
)
);
您可能不希望將CSV文件用作中介,而是要研究JMP和R集成。
@ian_jmp建議從JMP調用R例程可能確實是解決問題的一種好方法。
如果您確實需要使用csv直通數據表,下面是一個簡單的示例,說明完成csv文件創建的一種方法
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA\big class.jmp" );
sp = Scatterplot 3D(
Y( :age, :height, :weight ),
Frame3D( Set Grab Handles( 0 ), Set Rotation( -54, 0, 38 ) )
);
sp << on close(
theScript = Char( (Report( sp ) << get scriptable object) << get script );
varsList = {};
Insert Into( varsList, Word( 2, Substr( theScript, Contains( theScript, "Y(" ) ), ":," ) );
Insert Into( varsList, Word( 4, Substr( theScript, Contains( theScript, "Y(" ) ), ":," ) );
Insert Into( varsList, Word( 6, Substr( theScript, Contains( theScript, "Y(" ) ), ":,)" ) );
rotationList = {};
Insert Into( rotationList, Word( 2, Substr( theScript, Contains( theScript, "Rotation(" ) ), "()," ) );
Insert Into( rotationList, Word( 3, Substr( theScript, Contains( theScript, "Rotation(" ) ), "()," ) );
Insert Into( rotationList, Word( 4, Substr( theScript, Contains( theScript, "Rotation(" ) ), "()," ) );
dtSub = dt << subset( columns( Eval( varsList ) ), selected rows( 0 ) );
dtSub << New Column( "_Vars_", character, set values( varsList ) );
dtSub << New Column( "_Rotation_", character, set values( rotationList ) );
dtSub << Save( "$TEMP/passvalues.csv" );
close( dtSub, nosave );
);
// This line opens the csv back into JMP
//open("$TEMP/passvalues.csv");