how to change the numbering of rows in r

# Create a sample data frame
df <- data.frame(name = c("Alice", "Bob", "Charlie"),
                 age = c(25, 30, 22))

# Add a new column with the row numbers
df$row_number <- seq_len(nrow(df))