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
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