public static <T> Collector<T, ?, Optional<Double>> regrR2Double(ToDoubleFunction<? super T> functionX, ToDoubleFunction<? super T> functionY) {
        return collectingAndThen(
            collectors(
                varianceDouble(functionY),
                varianceDouble(functionX),
                correlationDouble(functionX, functionY)
            ),
            t -> mapAll(t.limit2(), (v1, v2) -> v1 == 0.0 ? null : v2 == 0.0 ? 1.0 : t.v3.map(v3 -> Math.pow(v3, 2)).orElse(null))
        );
    }
Get a {@link Collector} that calculates the <code>regrR2Double()</code> function.
jOOL/src/main/java/org/jooq/lambda/Agg.java