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.

0

1 Answer 1

1

You can use paste0:

rownames(df) <- paste0("IL", 1:nrow(df)) 
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you so much Chris!
Thanks for this. Did you know you can also accept an answer by clicking the tick mark in the left upper corner?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.