code: def write_r(df, f, sep=",", index_join="@", columns_join="."):
      
  
      df = df.copy()
      df.index = ["@".join([str(s) for s in v]) for v in df.index.values]
      df.columns = [".".join([str(s) for s in v]) for v in df.index.values]
      df.to_csv(f, sep=sep)
docs: Export dataframe in a format easily importable to R
  
      Index fields are joined with "@" and column fields by "." by default.
      :param df:
      :param f:
      :param index_join:
      :param columns_join:
      :return: