rExtractCluster function

String rExtractCluster(
  1. String log,
  2. WidgetRef ref
)

Implementation

String rExtractCluster(
  String log,
  WidgetRef ref,
) {
  // Extract from the R log those lines of output from the cluster.

  String extract = _basicTemplate(log, ref);

  // Now clean up the output for an annotated presentation of the output.

  // Given there are 10 clusters, for the cluster centers add a separating blank
  // line after each group of centers, for the case where the variables are more
  // than fit on one line.

  final pattern = RegExp(r'\n10.*?(?=\n)');

  extract = extract.replaceAllMapped(pattern, (match) {
    return '${match.group(0)}\n';
  });

  return extract;
}