import json


def get_r_version(path):
    """Get the version of R specified in the renv.lock file

    Parameters
    ----------
    path : str
        Path to the project directory. The file path/renv.lock must exist.

    Returns
    -------
    str
        R version
    """
    with open(f"{path}/renv.lock", "r") as f:
        r_json = json.load(f)

    return r_json["R"]["Version"]