cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

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

Trying to use Remove(source, {items})

I'm trying to remove 2 items from a list but I'm getting this error

 

"index must be number or list of numbers at row 1 in access or evaluation of 'List' , {/*###*/lst2}"

 

lst = As List((Associative Array( dt1:Name << get values ) << Get Keys))
lst2 = As List( {"NTC","PC"})
Remove( lst, {lst2})

lst = As List((Associative Array( dt1:Name << get values ) << Get Keys))
lst2 = As List( {"Pete","Clare"})
Remove( lst, lst2)

I've tried both there options and they both return an error. Where am I going wrong?

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: Trying to use Remove(source, {items})

Error message is quite clear here, you need to have number or list of number which you use for deletion, not a list of strings

jthi_0-1654852474195.png

 

Without knowing more about what you are trying to do, you could for example use Filter Each or Associative Array

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

lst = Associative Array(dt:Name << get values);
lst2 = Associative Array({"KATIE", "BARBARA"});
show(Contains(lst, "KATIE"));
lst << Remove(lst2);
lst = lst << get keys;
show(Contains(lst, "KATIE"));

Work with Associative Arrays (jmp.com)

 

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: Trying to use Remove(source, {items})

Error message is quite clear here, you need to have number or list of number which you use for deletion, not a list of strings

jthi_0-1654852474195.png

 

Without knowing more about what you are trying to do, you could for example use Filter Each or Associative Array

 

Names Default To Here(1);
dt = Open("$SAMPLE_DATA/Big Class.jmp");

lst = Associative Array(dt:Name << get values);
lst2 = Associative Array({"KATIE", "BARBARA"});
show(Contains(lst, "KATIE"));
lst << Remove(lst2);
lst = lst << get keys;
show(Contains(lst, "KATIE"));

Work with Associative Arrays (jmp.com)

 

-Jarmo

Recommended Articles