r'''Returns the R-value of a substance given its thermal conductivity,
    Will return R-value in SI units unless SI is false. SI units are
    m^2 K/(W*inch); Imperial units of R-value are ft^2 deg F*h/(BTU*inch).

    Parameters
    ----------
    k : float
        Thermal conductivity of a substance [W/m/K]
    SI : bool, optional
        Whether to use the SI conversion or not

    Returns
    -------
    R_value : float
        R-value of a substance [m^2 K/(W*inch) or ft^2 deg F*h/(BTU*inch)]

    Notes
    -----
    Provides the reverse conversion of R_value_to_k.

    Examples
    --------
    >>> k_to_R_value(R_value_to_k(0.12)), k_to_R_value(R_value_to_k(0.71, SI=False), SI=False)
    (0.11999999999999998, 0.7099999999999999)

    References
    ----------
    .. [1] Gesellschaft, V. D. I., ed. VDI Heat Atlas. 2nd edition.
       Berlin; New York:: Springer, 2010.

def k_to_R_value(k, SI=True):
    r'''Returns the R-value of a substance given its thermal conductivity,
    Will return R-value in SI units unless SI is false. SI units are
    m^2 K/(W*inch); Imperial units of R-value are ft^2 deg F*h/(BTU*inch).

    Parameters
    ----------
    k : float
        Thermal conductivity of a substance [W/m/K]
    SI : bool, optional
        Whether to use the SI conversion or not

    Returns
    -------
    R_value : float
        R-value of a substance [m^2 K/(W*inch) or ft^2 deg F*h/(BTU*inch)]

    Notes
    -----
    Provides the reverse conversion of R_value_to_k.

    Examples
    --------
    >>> k_to_R_value(R_value_to_k(0.12)), k_to_R_value(R_value_to_k(0.71, SI=False), SI=False)
    (0.11999999999999998, 0.7099999999999999)

    References
    ----------
    .. [1] Gesellschaft, V. D. I., ed. VDI Heat Atlas. 2nd edition.
       Berlin; New York:: Springer, 2010.
    '''
    r = k_to_thermal_resistivity(k)
    if SI:
        return r*inch
    else:
        return r/(foot**2*degree_Fahrenheit*hour/Btu/inch)