resetCategories method

void resetCategories(
  1. Iterable<String> categories
)

Resets the categories; for example, if we would like the categories of two categoric columns to match.

Implementation

void resetCategories(Iterable<String> categories) {
  final newCategories = [
    ...{
      for (final c in categories)
        if (c.toUpperCase() != missingValueMarker) c
    }
  ];
  for (var i = 0; i < length; i++) {
    final value = this[i];
    _data[i] =
        value == missingValueMarker ? -1 : newCategories.indexOf(value);
  }
  this._categories
    ..clear()
    ..addAll(categories);
}