We are generating a script to automate production of 2D X Y coordinate columns from a user-selected 3D graph orientation. The script will call an R code to perform the calculations, but needs to provide the XYZ column data and the rotation settings to R.
From a saved scatterplot 3D script we can see the XYZ column names (zue1...) and the rotation settings (-8....). We need jsl code to select those columns and export a csv file . And code to select and export the values of the rotation settings.
Any advice would be appreciated.
Scatterplot 3D(
Y( :zue1, :zue2, :zue3 ),
Frame3D(
Set Grab Handles( 0 ),
Set Rotation( -8.15592033195416, 47.3040538060599, 75.4291344975828 )
)
);
Rather than using CSV files as an intermediary, you might like to look into the JMP and R integration.
@ian_jmp suggestion of calling the R routines from JMP might really be a great way of solving the problem.
If you really need to use a csv pass through data table, here is a simple example of one way to accomplish the creation of a csv file
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");