두 개의 dataframe 비교

Published by onesixx on

https://stackoverflow.com/questions/10592148/compare-if-two-dataframe-objects-in-r-are-equal

 

a <- data.frame(x = 1:10)
b <- data.frame(x = 1:10)

all(a==b)         # TRUE
identical(a,b)    # TRUE

 

## 컬럼명이 같아야 함
a <- data.frame(x = 1:10)
b <- data.frame(y = 1:10)

all(a==b)                       # TRUE
identical(a,b)                  # FALSE
identical(a[ ,"x"], b[ ,"y"])   # TRUE

 

## Class가 같아야 함
a <- data.frame(x = 1:10)
b <- tbl_df(a)

all(a==b)         # TRUE
identical(a,b)    # FALSE

 

 

 

 

Categories: Reshaping

onesixx

Blog Owner

Subscribe
Notify of
guest

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