Last active
November 19, 2018 16:56
-
-
Save kawasaki2013/948af3c20f83e19b3d77fc4d804f61b3 to your computer and use it in GitHub Desktop.
参考 R言語
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ``` | |
| # 行列を作成 | |
| matrix(c(1, 2, 3, 4), nrow = 2) # 引数nrowで行列の行数を指定 | |
| matrix(c(1, 2, 3, 4), nrow = 2, byrow = TRUE) # 引数byrowでTRUEを指定すると、数字の配置が換わる(要注意) | |
| # 変数に行列を代入 | |
| m1 <- matrix(c(12, 17, 22, 16), nrow = 2) | |
| # 代入結果を確認 | |
| m1 | |
| # 行列の行数や列数を確認 | |
| nrow(m1) | |
| ncol(m1) | |
| dim(m1) | |
| ``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment