change a cell value in a matrix using row and column name in r

# Create a matrix
mat <- matrix(1:9, nrow = 3, dimnames = list(c("A", "B", "C"), c("X", "Y", "Z")))
print(mat)

# Change value at row "B", column "Y" to 100
mat["B", "Y"] <- 100
print(mat)
189 chars
8 lines

related categories

gistlibby LogSnag