Group Abstract Group Abstract

Message Boards Message Boards

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

How to find all classes that FormulaData is organized into?

POSTED BY: Peter Burbery
4 Replies
Posted 3 years ago

That is quite convoluted. A simpler way to get the same result and ~10x faster.

AssociationMap[FormulaData[#, "Classes"] &][FormulaData[]] // Values //
    DeleteMissing // Flatten[#, 1] & // Union
POSTED BY: Rohit Namjoshi

That's much simpler and easier to read and understand.

POSTED BY: Peter Burbery
Posted 3 years ago

It is not clear what you mean by

how I can find both classes

For

"AbbeNumberHelium" -> {"Physics", {"Physics", "Optics"}}

Which of the following do you want?

"AbbeNumberHelium" -> {"Physics", "Optics"}
"AbbeNumberHelium" -> "Physics", "AbbeNumberHelium" -> "Optics"
"AbbeNumberHelium" -> "Physics", "AbbeNumberHelium" -> {"Physics", "Optics"}}
POSTED BY: Rohit Namjoshi

I would use Values on an association of the last line and then Union to delete duplicates and order them.

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