Skip to contents

This function allows you to add additional data on users who created mental models, eg. age, gender, whether they like cycling... This data can then be used to eg. aggregate or compare models by variables.

Usage

add_user_data(mentalmodel, user_data, id_key)

Arguments

mentalmodel

An mtoolr object to add data to

user_data

A data frame containing at least a column to match user M-Tool user ids. It must contain an entry for all users.

id_key

The key of the data frame column to match M-Tool user ids.

Examples

# simulate user data to add, including a column "id" to match M-Tool user data
user_df <- data.frame(id = example_models$user_data$id,var = rnorm(length(example_models$user_data$id)))
# add user data by matching on column "id
example_models <- example_models |> add_user_data(user_data = user_df,id_key = "id")