0

I am trying to rename rows in my dataset. I need to change them like this: first row would be named "IL1", second "IL2",..., "ILn", where n is a number of rows in the dataset. I know how to change it by for example rownames(df) <- c("IL1","IL2","IL3","IL4"). But type it word by word is possible only in smaller datasets. I need to change it in dataset where are hundreds of rows. Any ideas? Thank you.

ondrej
  • 11
  • 1

1 Answers1

1

You can use paste0:

rownames(df) <- paste0("IL", 1:nrow(df))
Chris Ruehlemann
  • 20,321
  • 4
  • 12
  • 34