For matrices, mean (X) is a row vector containing the mean value of each column.
对于矩阵来说,MEAN (X)是包含了每列平均值的行向量。
One thing that can be confusing about R's "everything is a vector" approach is that row-wise and column-wise operations may not adhere to your intuition.
关于 R 的 “所有东西都是向量” 方式,容易引起混乱的一点是行操作和列操作可能不符合直觉。
But if you wanted to create a vector to sum each row, you might be inclined to try the following.
但是,如果希望创建一个向量来求每行的总和,您可能会编写下面这样的代码。
应用推荐