Left 조인과 Right 조인

R의 data.table로 데이터 결합하기

Scott Ritchie

Postdoctoral Researcher in Systems Genomics

Left 조인

오른쪽 data.table의 정보를 왼쪽 data.table추가

merge(x = demographics, y = shipping, by = "name", all.x = TRUE)

R의 data.table로 데이터 결합하기

Right 조인

왼쪽 data.table의 정보를 오른쪽 data.table추가

merge(x = demographics, y = shipping, by = "name", all.y = TRUE)

R의 data.table로 데이터 결합하기

Right 조인 = Left 조인

# Right join
merge(x = demographics, y = shipping, by = "name", all.y = TRUE)

# Same as
merge(x = shipping, y = demographics, by = "name", all.x = TRUE)
R의 data.table로 데이터 결합하기

기본값

  • merge() 함수에서 all, all.x, all.y의 기본값은 FALSE

  • help("merge")를 사용하여 함수 인수의 기본값 확인 가능

R의 data.table로 데이터 결합하기

실습 안내

shippingdemographics에 Left 조인:

merge(demographics, shipping, by = "name", all.x = TRUE)

shippingdemographics에 Right 조인:

merge(demographics, shipping, by = "name", all.y = TRUE)
R의 data.table로 데이터 결합하기

연습해 봅시다!

R의 data.table로 데이터 결합하기

Preparing Video For Download...