Now both melted dataframes will contain the same color mapping information. This can be useful if you want to make sure that different graphs have consistent legends

match_cdf(
  mdf,
  df_match,
  df_is_mdf = TRUE,
  group_level = "Phylum",
  subgroup_level = "Genus"
)

Arguments

mdf

data.frame, melted data frame to apply legend to

df_match

data.frame, data frame to use legend from

df_is_mdf

logical, true if df_match is a mdf, false if df_match is a cdf

group_level

string of larger taxonomic group

subgroup_level

string of smaller taxonomic group

Value

data.frame, melted df with ordered factor that are consistent with the legend

Examples

mdf_to_plot <- match_cdf(mdf, df_match)
#> Error in match_cdf(mdf, df_match): object 'mdf' not found