Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- JMP User Community
- :
- Discussions
- :
- How to save a matrix formula into data table?

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Jan 17, 2014 9:20 AM
(675 views)

Hi,

Does any of you know how to use JSL to save a matrix formula into data table, such as ([1] || (X1 + 1))* [2, 3] ?

Directly typing it in the formula editor works. But using JSL, it doesn't allow me to save any expression into matrices/vectors.

For example, Concat(1,Expr(X1+1)); is invalid.

I’ve also tried to save the expression into a list first and then multiply it with a numerical vector/matrix. But JSL complains that the lists and matrices cannot be mixed together in the formula.

Have you encountered any JSL example that can save such formula expressed in vectors/matrices? Many thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

Solution

I've just learned from Ryan Lekivetz the following script which works great!

myexp1 = nameexpr( ([1] || X1 + 1) * [2,3]);

dtt=current data table();

Eval(Substitute(

Expr(dtt << New Column("formula1 ",<<Formula(__form1__))),

Expr(__form1__), Eval Expr(myexp1),

));

One surprising thing I've found is that the JMP profiler doesn’t recognize such matrix formulas. For example, typing (:X1 || :X2 ) * [2, 3] or 2*:X1+3*:X2 in the formula editor could yield exactly the same result in the data table, but the profiler doesn’t recognize the first version. This may be a bug for the profiler.

1 REPLY

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Get Direct Link
- Email to a Friend
- Report Inappropriate Content

I've just learned from Ryan Lekivetz the following script which works great!

myexp1 = nameexpr( ([1] || X1 + 1) * [2,3]);

dtt=current data table();

Eval(Substitute(

Expr(dtt << New Column("formula1 ",<<Formula(__form1__))),

Expr(__form1__), Eval Expr(myexp1),

));

One surprising thing I've found is that the JMP profiler doesn’t recognize such matrix formulas. For example, typing (:X1 || :X2 ) * [2, 3] or 2*:X1+3*:X2 in the formula editor could yield exactly the same result in the data table, but the profiler doesn’t recognize the first version. This may be a bug for the profiler.