Dataframe to vector

How can one transform the tmp dataframe to be a 2-element Vector in the same format as rand(2) produces? Thank you for the help! Sorry for the simple questions.

using DataFrames
x = rand(3)
y = rand(3)
z = rand(3)
df = DataFrame(x=x, y=y, z=z)

tmp = df[2, [:x, :z]]


collect(df[2, [:x, :z]])

edit: one caveat for collect versus Vector/Matrix is that the latter coerces its arguments to a uniform element type if possible, which may or may not be what you want.

julia> df.y = 1:3; df
3×3 DataFrame
 Row │ x          y      z
     │ Float64    Int64  Float64
   1 │ 0.0116169      1  0.72888
   2 │ 0.257525       2  0.842221
   3 │ 0.350478       3  0.528759

julia> collect(df[2, [:x, :y]])
2-element Vector{Real}:

julia> Vector(df[2, [:x, :y]])
2-element Vector{Float64}:



Side note. tmp is a DataFrameRow and this is the reason the proposed solutions work.

Thank you all for the help!

Why does the below change error (i.e, changed y column and how the dataframe row is selected)?
ERROR: MethodError: no method matching length(::DataFrame)

using DataFrames
x = rand(3)
y = [“a”, “b”, “c”]
z = rand(3)
df = DataFrame(x=x, y=y, z=z)
tmp = df[df.y .== “b”, [:x, :z]]

tmp = df[2, [:x, :z]]
collect(tmp) does not error

Thank you!

Please quote your quote in triple back-ticks

like this 

The reason is that df.y .== "b" produces a vector, not an integer. Therefore

df[df.y .== “b”, [:x, :z]]

produces a DataFrame, not a DataFrameRow.

And in DataFrame case it makes no sense to convert it to a Vector since it is a 2-dimensional object; you can convert it to a matrix by writing Matrix(tmp).