Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,如何在 r 中生成具有 {1 ... 15} 值的整数随机矩阵,其中 9 行和 100 列?
(我的问题可能是基本的,但由于未知原因我找不到解决方案)
matrix(sample.int(15, size = 9*100, replace = TRUE), nrow = 9, ncol = 100)
或更简洁的版本
matrix(sample.int(15, 9*100, TRUE), 9, 100)
但如果你真的想要最少的字符数(我不推荐):
matrix(sample(15,900,T),9)