Assume I have a dataframe a
and a vector y
a = DataFrame(t = [0; 0], x = [1, 2])
y = [0.1, 0.2, 0.3]
how can I combine these two to achieve something like the following, preferentially using DataFramesMeta.jl
?
Row │ t x
│ Float64 Int64
─────┼────────────────
1 │ 0.1 1
2 │ 0.2 1
3 │ 0.3 1
4 │ 0.1 2
5 │ 0.2 2
6 │ 0.3 2
Edit: I prefer to use DataFramesMeta.jl
because I like to use it in a @chain
pipe.
You don't really need DataFramesMeta; a simple join will do. By creating two
t
columns with just a single distinct element, a join becomes the cartesian product.