import re


def get_r_filename(r_file):
    """Remove the file extension from an r_file using regex. Probably unnecessary
       but improves readability
    Parameters
    ----------
    r_file : string
             name of R file including file extension
    Returns
    -------
    string
    name of R file without file extension
    """
    return re.split('\.[rR]$', r_file)[0]