cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Image to Table JMP extension imports single or batch images as data tables. Useful to extract curves from pictures or convert image data to curve data to use in analyses like Functional Data Explorer. Download and install the extension.

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