Learn R Programming

golfr (version 0.1.0)

updatemat: Update Interaction Matrix with Group Assignments

Description

This function updates an existing interaction matrix based on new group assignments. It increments the matrix values to track how often students have been grouped together.

Usage

updatemat(initialmat, group_assignments, students)

Value

An updated matrix reflecting the new group assignments.

Arguments

initialmat

A square matrix where rows and columns represent students, and cell values track the number of times two students have been grouped together.

group_assignments

A vector indicating the group assignments for each student.

students

A vector containing student identifiers corresponding to the matrix row and column names.

Examples

Run this code
n_students <- 4
student_data <- GenerateData(n_students)
initial_matrix <- initmat(student_data$Student)
group_assignments <- c(1, 1, 2, 2)  # Example group assignments

updated_matrix <- updatemat(initial_matrix, group_assignments, student_data$Student)
updated_matrix

Run the code above in your browser using DataLab