this Name Expr-like behavior is especially useful for the cases with
- As Column(...)
- column reference via variable (col)
as an argument.
dt = Open("$SAMPLE_DATA/Big Class.jmp");
col = Name Expr(As Column("age"));
Head(As Column("age"));
Head(col);
dt << Recode Column(AsColumn("age"),{1},Target Column(AsColumn("age")));
dt << Recode Column(col,{1},Target Column(col));
dt << Graph Builder(Variables( X( As Column ("age") ) ),Elements( Points( X ) ));
dt << Graph Builder(Variables( X( col) ),Elements( Points( X ) ));
on the other hand: functions which don't work if a column is entered via As Column():
dt = Open("$SAMPLE_DATA/Big Class.jmp");
col = Name Expr(As Column("age"));
Distribution(Column(As Column("age")));
The easy solution: wrap As Column with Name Expr:
Distribution(Column(Name Expr(As Column("age"))));
... or use Column() instead of As column where applicable:
Distribution(Column(Column("age")));
To distinguish between both cases, you can put a print(1); at the beginning of the argument:
dt << Graph Builder(Variables( X( Print(1);As Column ("age") ) ),Elements( Points( X ) )); // fails
Distribution(Column(Print(1);Column("age"))); // works