r - Julia equivalent of dplyr's bind_cols and bind_rows -
is there julia equivalent of dplyr's bind_cols , bind_rows? specifically, i'm looking bind_rows function match column names regardless of order , fill in na's non-matching columns
edit: r example of both:
library(dplyr) df1 = data.frame(a = 1, b = 1) df2 = data.frame(b = 1, c = 1) df3 = data.frame(c = 1, d = 1) bind_rows(df1, df2) b c 1 1 1 na 2 na 1 1 bind_cols(df1, df3) b c d 1 1 1 1 1
perhaps julia's vcat
, hcat
functions satisfy requirements.
julia> using dataframes julia> df1 = dataframe(a = 1, b = 1) 1x2 dataframes.dataframe | row | | b | |-----|---|---| | 1 | 1 | 1 | julia> df2 = dataframe(b = 1, c = 1) 1x2 dataframes.dataframe | row | b | c | |-----|---|---| | 1 | 1 | 1 | julia> df3 = dataframe(c = 1, d = 1) 1x2 dataframes.dataframe | row | c | d | |-----|---|---| | 1 | 1 | 1 | julia> vcat(df1, df2) 2x3 dataframes.dataframe | row | | b | c | |-----|----|---|----| | 1 | 1 | 1 | na | | 2 | na | 1 | 1 | julia> hcat(df1, df3) 1x4 dataframes.dataframe | row | | b | c | d | |-----|---|---|---|---| | 1 | 1 | 1 | 1 | 1 |
Comments
Post a Comment