convert dataframe row to vector r code example
Example 1: convert dataframe row to vector r
# if you wish to keep the names:
unlist(df[1,])
a b c
1.0 2.0 2.6
is.vector(unlist(df[1,]))
[1] TRUE
Example 2: convert dataframe row to vector r
# if all the columns are numeric:
as.numeric(df[1,])