getCategoric function

List<String> getCategoric(
  1. WidgetRef ref
)

Return a list of categoric variables that are not ignored and do not have too many levels.

Implementation

List<String> getCategoric(WidgetRef ref) {
  // The typesProvider lists the types for the different variables which we need
  // to know for parsing the R scripts.

  Map<String, Type> roles = ref.read(typesProvider);

  // Watching stdout to get variables that are Ignored.

  String stdout = ref.read(stdoutProvider);

  List<String> largeFactors = extractLargeFactors(stdout);

  List<String> result = [];

  roles.forEach((key, value) {
    if (value == Type.categoric &&
        !largeFactors.contains(key) &&
        ref.read(rolesProvider.notifier).state[key] != Role.ignore) {
      result.add(key);
    }
  });

  return result;
}