0

I am using biological data from an imported CSV file where the gene symbols are put into "column 0" as rownames. I would like to order the rows alphabetically based on gene symbol.

I was thinking of extracting the column 0 rownames to a new column and then ordering but I prefer leaving the dataset how it is. Is there anyway to order the row names instead?

learner123
  • 51
  • 5

1 Answers1

0
row_names_test <- data.frame(cbind(genes <- rownames(read.csv("~/row_names_test.csv")),
                                   read.csv("~/row_names_test.csv")))

row_names_test <- row_names_test[order(row_names_test$genes), ]
hello_friend
  • 5,329
  • 1
  • 9
  • 12