Changing values in a matrix depending on whether they are above of below a certain threshold value
问题 I have a matrix. If an element of the matrix is greater than 400, then I would like the element to become zero. If an element of the matrix is less than 400, then I would like to multiply the element by three. Here is how to reproduce my matrix: structure(c(122, 948, 952, 100, 942, 150, 150, 149, 244, 220, 437, 395, 356, 473, 434, 335, 357, 371, 590, 553, 520, 491, 426, 426, 427, 177, 284, 338, 391, 290, 345, 399, 143, 193, 136, 121, 122, 187, 177, 544), .Dim = c(10L, 4L), units = structure