cbind

Published by onesixx on

rbind / cbind는 vector/dataTable 형식을 받아서
row이나 column별로 combine한다.

> cbind(a=c(1:6), b=c(1,6))      # cbind for vector
#      a b
# [1,] 1 1
# [2,] 2 6
# [3,] 3 1
# [4,] 4 6
# [5,] 5 1
# [6,] 6 6

rbind와 bind는 list형식을 받으면 결과는 나오지만, 원하는 값이 아니다.

> rbind(ll)
   a         b        
ll Integer,6 Numeric,2
> rbind(ld)
   a      b     
ld List,5 List,5

> rbind(ll, ll)
   a         b        
ll Integer,6 Numeric,2
ll Integer,6 Numeric,2

> rbind(ld, ld)
   a      b     
ld List,5 List,5
ld List,5 List,5
Categories: R Reshaping

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x