R: Get indices of all elements in a vector?
问题 Simple questions, but I can't find an answer. I have a vector a<-c(5,6,7) how can I get back the indices for all elements in my vector? I need back 1 #"a" 2 #"b" 3 #"c" or c(1,2,3) If I run seq_along(a), it gives me back (1,1,1) not (1,2,3) : for (i in seq_along(a)) { print(seq_along(a[[i]])) } [1] 1 [1] 1 [1] 1 The reason for this is that I need to create a unique name for each of my plots. I have about 100 plots illustrating 100 locations. Locations'names are too long and contain special