How to multiply rows with the same propertiesHello,
I am trying to multiply certain rows based on their other properties. For example, I want to multiply the chance of having the same first and last name.
How can I do this in code?
Thank you.
Content OrganizationData AccessData Exploration and VisualizationRe: How to multiply rows with the same propertiesYou want to have something like this?

This is one fairly easy option
Names Default To Here(1);
dt = New Table("Untitled",
Add Rows(5),
Compress File When Saved(1),
New Column("A", Character, "Nominal", Set Values({"E", "E", "E", "E", "E"})),
New Column("B", Character, "Nominal", Set Values({"L", "C", "L", "L", "C"})),
New Column("C",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([5, 7, 10, 50, 7])
)
);
aa = Associative Array();
For Each Row(dt,
name = :A || :B;
If(!Contains(aa, name),
aa[name] = 1;
);
Multiply To(aa[name], :C);
);
newcol = dt << New Column("R", Numeric, Continuous, Formula(
aa[:A || :B];
));
dt << run formulas;
newcol << delete formula;Re: How to multiply rows with the same propertiesMy reading of @Liranlev is different from Jarmo's. I read the request as to be able to take the values of chance in rows 1 & 3 and multiply them together and place them in row 7, and take the value of row 7 and place them in row 8. This seems to be treating a JMP table as one might do this in Excel, but that aside, the script below will create the table.

dt = New Table("Untitled",
Add Rows(5),
Compress File When Saved(1),
New Column("A", Character, "Nominal", Set Values({"E", "E", "E", "E", "E"})),
New Column("B", Character, "Nominal", Set Values({"L", "C", "L", "L", "C"})),
New Column("C",
Numeric,
"Continuous",
Format("Best", 12),
Set Values([5, 7, 10, 50, 7])
)
);
aa = Associative Array();
For Each Row(dt,
name = :A || :B;
If(!Contains(aa, name),
aa[name] = 1;
);
Multiply To(aa[name], :C);
);
newcol = dt << New Column("R", Numeric, Continuous, Formula(
aa[:A || :B];
));
dt << run formulas;
newcol << delete formula;