updatemat: Update Interaction Matrix with Group Assignments

View source: R/updatemat.R

updatematR Documentation

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)

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.

Value

An updated matrix reflecting the new group assignments.

Examples

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

golfr documentation built on April 12, 2025, 1:48 a.m.

Related to updatemat in golfr...