Taylor Graph Builder-AusdruckLiebe Community,
Ich möchte ein Graph Builder-Skript erstellen (möchte es als Skript in eine neue Tabelle einfügen), das eine lange Liste von Y-Variablen enthält.
Mein erster Ansatz bestand darin, eine Ausdrucksmanipulation auszuprobieren, was jedoch nicht wie erwartet funktionierte.
Kann mir bitte jemand erklären, wie man dieses Skript am besten schreibt?
Das folgende Beispiel enthält auch meine aktuelle Methode, bei der die GB-Instanz erstellt und anschließend Y-Variablen hinzugefügt werden.
Danke und viele Grüße,
Names Default To Here( 1 );
cdt = Open( "$SAMPLE_DATA\Big Class.jmp" );
col_lst = cdt << get column names( Continuous, "String" );
gb_expr = Expr(
cdt << Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 4 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 5 ) ) )
)
);
// this does not work, Expr() does not accept comma separated items
// Substitute Into( gb_expr, Expr( Y( :height ) ), Expr( Y( :height ), Y( :weight ) ) );
// gb_obj = gb_expr;
// this works
// creating GB instance
gb_obj = cdt << Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :age )),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 4 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 5 ) ) )
);
// adding Y's
For Each( {ycol}, col_lst, Eval( Parse( Eval Insert( "gb_obj << variables( Y(:^ycol^ ))" ) ) ) );
// this I would like to create directly, w/o large parse/eval parts, that are bad for maintenance
my_target_expression = gb_obj << get script();
Automatisierung und SkriptingBetreff: Taylor Graph Builder-AusdruckKönnte diese kleine Änderung zur Verwendung von Eval(Eval Expr()) Ihnen das bieten, was Sie wollen
Names Default To Here( 1 );
cdt = Open( "$SAMPLE_DATA\Big Class.jmp" );
col_lst = cdt << get column names( Continuous, "String" );
gb_expr = Expr(
cdt << Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :age ), Y( :height ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 4 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 5 ) ) )
)
);
// this does not work, Expr() does not accept comma separated items
// Substitute Into( gb_expr, Expr( Y( :height ) ), Expr( Y( :height ), Y( :weight ) ) );
// gb_obj = gb_expr;
// this works
// creating GB instance
gb_obj = cdt << Graph Builder(
Size( 534, 450 ),
Show Control Panel( 0 ),
Variables( X( :age ) ),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 4 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 5 ) ) )
);
// adding Y's
For Each( {ycol}, col_lst,
Eval( Eval Expr( gb_obj << variables( Y( Expr( ycol ) ) ) ) )
);
// this I would like to create directly, w/o large parse/eval parts, that are bad for maintenance
my_target_expression = gb_obj << get script();Betreff: Taylor Graph Builder-AusdruckHallo Jim,
danke, das funktioniert auch mit eval/evalexpr.
Aber meine Frage war, wie ich diesen vollständigen gb_expr im oberen Teil erstellen könnte,
mein Showstopper war, dass:
Substitute Into( gb_expr, Expr( Y( :height ) ), Expr( Y( :height ), Y( :weight ) ) );
funktioniert nicht.
Daher möchte ich mithilfe der Ausdrucksmanipulation (nicht der Zeichenfolgenmanipulation) viele „Y(:c1), Y(:c2) …“ in den Graph Builder-Ausdruck einsetzen.
Beste grüße,
Betreff: Taylor Graph Builder-AusdruckIch weiß nicht, wie ich das Substitute-Problem umgehen kann. Vielleicht möchten Sie die Scripting Index Graph Builder-Nachrichten untersuchen, die an Graph Builder übergeben werden können.

Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
gb = Graph Builder(
Variables( X( :sex ) ),
Elements( Points( X, Y ), Smoother( X, Y ) )
);
gb << Add Variable( {:height, Role( "Y" )} );
gb << Add Variable( {:weight, Role( "Y" )} );Betreff: Taylor Graph Builder-Ausdruck@Georg
Aufbauend auf dem Vorschlag von @txnelson , Nachrichten an den Graph Builder zu senden, könnte dies Sie dem Gesuchten näher bringen:
Names Default To Here( 1 );
cdt = Open( "$SAMPLE_DATA/Big Class.jmp" );
col_lst = cdt << get column names( Continuous, "String" );
gb = Graph Builder(
Variables( X( :age ) ),
Elements( Points( X, Y ) )
);
for each( { yCol }, col_lst,
gb << Add Variable( { eval( yCol ), Role( "Y" ) } );
);
Das resultierende Graph Builder-Skript lautet:
Graph Builder(<BR />Variables( X( :age ), Y( :height ), Y( :weight ) ),<BR />Elements( Position( 1, 1 ), Points( X, Y, Legend( 1 ) ) ),<BR />Elements( Position( 1, 2 ), Points( X, Y, Legend( 2 ) ) )<BR />);
Betreff: Taylor Graph Builder-AusdruckDanke an alle, das sieht gut aus!
Betreff: Taylor Graph Builder-AusdruckNormalerweise verwende ich dafür keine Ersatzwörter, sondern baue sie mit Ausdrücken auf. Unten ist eine Option, aber es gibt noch andere Optionen.
Names Default To Here(1);
dt = Open("$SAMPLE_DATA\Big Class.jmp");
col_lst = cdt << get column names(Continuous, "String");
var_expr = Expr(Variables(X(:age)));
For Each({colname}, col_lst,
colname = "height";
Insert Into(var_expr, EvalExpr(Y(Expr(Name Expr(As Column(dt, colname))))));
);
gb_expr = EvalExpr(
dt << Graph Builder(
Size(534, 450),
Show Control Panel(0),
Expr(Name Expr(var_expr))
);
);
gb = Eval(gb_expr);
// gb << get script
gb << Save Script to Data Table("Plot");
Wenn Sie nur Substitute verwenden möchten, müssen Sie wahrscheinlich den gesamten Variablenteil ersetzen (oder möglicherweise einige Tricks anwenden).
Names Default To Here(1);
cdt = Open("$SAMPLE_DATA\Big Class.jmp");
col_lst = cdt << get column names(Continuous, "String");
gb_expr = Expr(
cdt << Graph Builder(
Size(534, 450),
Show Control Panel(0),
Variables(X(:age), Y(:height)),
Elements(Position(1, 1), Points(X, Y, Legend(4))),
Elements(Position(1, 2), Points(X, Y, Legend(5)))
)
);
Substitute Into(gb_expr, Expr(Variables(X(:age), Y(:height))), Expr(Variables(X(:age), Y(:height), Y(:weight))));
show(gb_expr);