Skip to content

Instantly share code, notes, and snippets.

@yuu-ito
Last active December 26, 2015 04:39
Show Gist options
  • Save yuu-ito/7094938 to your computer and use it in GitHub Desktop.
Save yuu-ito/7094938 to your computer and use it in GitHub Desktop.
Rのmerge関数で3つ以上のデータフレームを結合したかったので。 ググって見つけたものをまとめておく。
merge2 <- function(dfs, ...)
{
  # res <- merge2(list(Df1, Df2, Df3), by="ID")
  base <- dfs[1]
  lapply(dfs[-1], function(i) base <<- merge(base, i, ...)) # [1]
return(base)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment