Creates a data frame that links each individual to a particular sample. The column m can be easily passed to the data simulation functions, and to the Stan reinforcement learning model.

get_sample_index(splt_df, id_col = "id", sample_col = "sample",
  levels = sort(unlist(unique(splt_df[, sample_col]))))

Arguments

splt_df

a data frame containing data from the SPLT

id_col

the name of the id column

sample_col

the name of the sample column

levels

the levels to be used in coercing the sample column to a factor (to control ordering)

Value

a data frame with columns id_col, sample_col, m_fac (with sample_col coerced to a factor) and m (with m_fac coerced to a number)