numere-org / NumeRe

Framework for numerical computations, data analysis and visualisation
https://www.numere.org
GNU General Public License v3.0
20 stars 7 forks source link

'hist' shall use categories, if available #121

Closed numeredev closed 1 year ago

numeredev commented 1 year ago

SUMMARY

Implements necessary changes for #26

Reviewers: @numere-org/maintainers

IMPLEMENTATION

DOCUMENTATION


TESTS BY REVIEWERS

numeredev commented 1 year ago

To test this change

new categories(), result() -free
## Create some categories
categories(:,1) = {"Hello", "World", "World", "Hello", "Hello"};
categories(:,2) = {"Hello", "Hello", "World", "Hello", "World"};
categories(:,3) = {"A", "B", "A", "C", "D", "A", "C"};

## Add headlines
categories(#,:) = {"Hi", "Hi2", "Alpha"};

## Convert strings to categories
categories().convert({1:2}, "category");

## Test one category
hist categories(:,1) -set target=result()
assert result(:,1) == {"Hello", "World"};
assert result(:,2) == {3, 2};

## Test also category mixtures with two columns and three columns:
## Assumption is: column 1 and 2 result in the same categories, column 1,2,3 together will use 
## generic categories like "Cat:1", "Cat:2", ...