Skip to contents

This function is called within the mapMetadata function.

Given a specific table and a number of data elements to search, it checks for 3 different sources of domain categorisation:

1 - If data elements match those in the look-up table, auto categorise them

2 - If data elements match to previous table output, copy them

3 - If no match for 1 or 2, data elements are categorised by the user

Usage

user_categorisation_loop(
  start_v,
  end_v,
  Table_df,
  df_prev_exist,
  df_prev,
  lookup,
  df_plots,
  Output
)

Arguments

start_v

Index of data element to start

end_v

Index of data element to end

Table_df

Dataframe with the table information, extracted from json metadata

df_prev_exist

Boolean to indicate with previous dataframes exist (to copy from)

df_prev

Previous dataframes to copy from (or NULL)

lookup

The lookup table to enable auto categorisations

df_plots

Output from the ref_plot function, to indicate maximum domain code allowed

Output

Empty Output dataframe, to fill

Value

An Output dataframe containing information about the table, data elements and categorisations