del row matrix r

# Assuming 'matrix_r' is your matrix
# Assuming 'row_index_to_delete' is the index of the row you want to delete

# Step 1: Check the number of rows in the matrix
num_rows <- nrow(matrix_r)

# Step 2: Create an index vector for rows to keep
rows_to_keep <- setdiff(1:num_rows, row_index_to_delete)

# Step 3: Subset the matrix to keep only the desired rows
result_matrix <- matrix_r[rows_to_keep, , drop = FALSE]