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の行列の列を変数としてロードするにはどうすればよいですか? それを行った後、for ループで作成されたその変数の個々の行要素にアクセスしたいのですが、どうすればそれにアクセスできますか? 行列自体は 2 次元のみです。
使用する[
[
サンプル マトリックス:
> mat=matrix(1:6, 2) > mat [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6
列 2 を抽出します。
> mat[,2] [1] 3 4
あなたは実際に何をしようとしていますか? forほとんどの場合、間違ったアプローチです。
for