Answers for "convert dataframe row to vector r"

R
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
Posted by: Guest on April-20-2021
0

convert dataframe row to vector r

# if all the columns are numeric:
as.numeric(df[1,])
Posted by: Guest on April-20-2021

Browse Popular Code Answers by Language