Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.9K Views
|
4 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How can I select associations from a list of associations

Posted 10 years ago

Hi everyone,

I have as list of 50 associations called bigIndex, where the keys are simply the numbers 1 through 50. How can I select or extract a subset of those associations, for example, the associations whose keys are 1, 23, and 47?

Regards,

Gregory

POSTED BY: Gregory Lypny
4 Replies
Posted 10 years ago

I too thought I had a list of associations. I created it using GroupBy and mistakenly thought it had created a list like GatherBy does. How embarrassing.

Thanks again,

Gregory

POSTED BY: Gregory Lypny
Posted 10 years ago

Hi Sander,

You were on the right track! This works:

bigIndex[[{Key[1], Key[23], Key[47]}]]

Gregory

POSTED BY: Gregory Lypny

aah ok, I thought you had something like {assoc1,assoc2,assoc3,...} (a list of associations). But you just have 1 association! well, you understand the idea now, which is more valuable!

POSTED BY: Sander Huisman

does

bigIndex[[All,{1,23,47}]]

or

bigIndex[[All,{Key[1],Key[23],Key[47]}]]

work?

POSTED BY: Sander Huisman
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard