Skip to content

Instantly share code, notes, and snippets.

@amirbehzad
Last active January 16, 2017 06:20
Show Gist options
  • Save amirbehzad/bfb912c182a356ca367d19620024108c to your computer and use it in GitHub Desktop.
Save amirbehzad/bfb912c182a356ca367d19620024108c to your computer and use it in GitHub Desktop.
cbind.r
df1 <- createDataFrame(data.frame(a=c(1,2,3)))
df2 <- createDataFrame(data.frame(b=c(2,3,4)))
df1 = withColumn(df1, "index", monotonically_increasing_id())
df2 = withColumn(df2, "index", monotonically_increasing_id())
df_new = drop(
merge(df1, df2, by="index"),
c("index_x", "index_y"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment