checkRInstallation function

Future<bool> checkRInstallation()

Implementation

Future<bool> checkRInstallation() async {
  // Try to run the R command to check its availability.

  // 20250113 gjw Exploring Andriod deployment. For no ignore the check for R
  // installed.

  if (Platform.isAndroid) return true;

  try {
    final result = await Process.run('R', ['--version']);

    // Check if "R version" is present in the output.

    return result.exitCode == 0;
  } catch (e) {
    // R is not installed or not in PATH.

    return false;
  }
}