R merge()

1 개요[ | ]

R merge()
  • 특정 컬럼(들)을 기준으로 컬럼들을 병합하는 R 함수
  • SQL의 JOIN과 유사하다.
all 옵션 SQL JOIN
all=FALSE (기본값) INNER JOIN
all=TRUE FULL OUTER JOIN
all.x=TRUE LEFT JOIN
all.y=TRUE RIGHT JOIN
majors <- read.table( header=TRUE, stringsAsFactors=FALSE, text="
Name    Major
Alice   Art
Bob     Biology
Dave    Dance
Eve     English
")
grades <- read.table( header=TRUE, stringsAsFactors=FALSE, text="
Name    Grade
Alice   A
Bob     B
Carol   C
")
merge(x=majors, y=grades, id='Name')
merge(x=majors, y=grades, id='Name', all=TRUE)
merge(x=majors, y=grades, id='Name', all.x=TRUE)
merge(x=majors, y=grades, id='Name', all.y=TRUE)

2 같이 보기[ | ]

3 참고[ | ]

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