cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Sign-in to the JMP Community will be unavailable intermittently Dec. 6-7 due to a system update. Thank you for your understanding!
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.
  • JMP 19 is here! Learn more about the new features.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
Djtjhin
Level IV

How to assign a list of values to specific list of rows (without for loop)

Is there a way to assign a list of values to specific rows in a column without for loop ?

 

For instance, is it possible to assign the "new values" in the script below to row 1,5,7 on the Weight column ? 

The script below doesn't work. I know one of the way to do this is to use for loop, but I wonder if there are other methods without for loops. 

 

dt = Open( "$SAMPLE_DATA/Big Class.jmp" );

index = [1,5,7];
new values = [11,22,33];
dt:weight[index] = new values;

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to assign a list of values to specific list of rows (without for loop)

No need to loop. This should work:

 

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

index = [1, 5, 7];
new values = [11, 22, 33];
dt[index, "weight"] = new values;

Used this great source as reference

 

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: How to assign a list of values to specific list of rows (without for loop)

No need to loop. This should work:

 

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Big Class.jmp");

index = [1, 5, 7];
new values = [11, 22, 33];
dt[index, "weight"] = new values;

Used this great source as reference

 

-Jarmo
Djtjhin
Level IV

Re: How to assign a list of values to specific list of rows (without for loop)

Fantastic @jthi !! Learn something new today :)

Recommended Articles