Luuk
Luuk

Reputation: 75

Naming data frames in lists using a sequence

I have a rather simple question. So I have a list, and I want to name the data frames in the list according to a sequence. Right now I have a sequence that increase according to one letter per list (explained below):

    nm1 <- paste0("Results_Comparison_",LETTERS[seq_along(Model_comparisons)])

This creates "Results_Comparison_A", "Results_Comparison_B", "Results_Comparison_C", "Results_Comparison_D", etc. What I want is it for it to be a number instead of a letter. (i.e. Results_Comparison_1, Results_Comparison_2, Results_Comparison_3, etc.) Does anyone know how I could change this? If extra information is needed let me know!

Upvotes: 0

Views: 27

Answers (1)

Marco De Virgilis
Marco De Virgilis

Reputation: 1089

This should work paste0("Results_Comparison_",seq_along(Model_comparisons))

Upvotes: 1

Related Questions