"R matrix()"의 두 판 사이의 차이

2번째 줄: 2번째 줄:
;R matrix()
;R matrix()


<source lang='r'>
<source lang='r' run>
matrix( c(1,2,3,4,5,6), 2, 3)
matrix( c(1,2,3,4,5,6), 2, 3)
##      [,1] [,2] [,3]
</source>
## [1,]    1    3    5
<source lang='r' run>
## [2,]    2    4    6
matrix( c(1,2,3,4,5,6), 3, 2)
matrix( c(1,2,3,4,5,6), 3, 2)
##      [,1] [,2]
## [1,]    1    4
## [2,]    2    5
## [3,]    3    6
</source>
</source>
<source lang='r'>
<source lang='r' run>
options(echo = TRUE)
A <- matrix( c(1,2,3,4,5,6), nrow=2, ncol=3)
A <- matrix( c(1,2,3,4,5,6), nrow=2, ncol=3)
class(A)
class(A)
## [1] "matrix"
str(A)
str(A)
##  num [1:2, 1:3] 1 2 3 4 5 6
A
A
##      [,1] [,2] [,3]
## [1,]    1    3    5
## [2,]    2    4    6
</source>
</source>
<source lang='r'>
<source lang='r' run>
options(echo = TRUE)
A <- matrix( c(1,2,3,4,5,6), nrow=2, ncol=3, byrow=TRUE)
A <- matrix( c(1,2,3,4,5,6), nrow=2, ncol=3, byrow=TRUE)
class(A)
class(A)
## [1] "matrix"
str(A)
str(A)
##  num [1:2, 1:3] 1 4 2 5 3 6
A
A
##      [,1] [,2] [,3]
## [1,]    1    2    3
## [2,]    4    5    6
</source>
</source>



2020년 4월 16일 (목) 00:27 판

1 개요

R matrix()
matrix( c(1,2,3,4,5,6), 2, 3)
matrix( c(1,2,3,4,5,6), 3, 2)
options(echo = TRUE)
A <- matrix( c(1,2,3,4,5,6), nrow=2, ncol=3)
class(A)
str(A)
A
options(echo = TRUE)
A <- matrix( c(1,2,3,4,5,6), nrow=2, ncol=3, byrow=TRUE)
class(A)
str(A)
A

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}