Home > Blockchain >  Take a row as a column without transpose
Take a row as a column without transpose

Time:08-28

I have a dataframe that I want to take only the values of one row, for all columns (as a numeric vector). One way of doing that would be df_trasposed = t(df), and then I can just take the wanted column with df_trasposed$column

I feel there is a better way of doing it, without creating a new data frame and taking more memory. I tried something like t(df)$column but this won't work obviously.

How can this be done?

CodePudding user response:

Try this

as.numeric(df['rowname',])
  • Related