Creating vector with a repeat results in a invalid 'times' argument

I'm trying to make a quick vector with the following and I keep getting an error for an invalid 'times' argmuent. But I don't understand why as what I am putting for times are all integers. I'm trying to make a vector that repeats the different strings a different number of times. I'm really new to R, so it may be something simple, but I'm not sure. Below are the two different things I've tried:

vector.names<-rep(c("CA 24h","CA 28day","An 28day","An 24h","T0",t),c(6,6,3,6,3))

vector.names<-rep(c("CA 24h","CA 28day","An 28day","An 24h","T0",t),times=c(6,6,3,6,3))

Hello,

your input vector c("CA 24h","CA 28day","An 28day","An 24h","T0",t) to repeat is of length 6, while your times argument is of length 5. So rep() does not know what to do with the 6th argument in this case. Add a 6th entry and the call will work (but be aware that you use the function t() as 6th input in your input vector - is this intended?)

Oh! I didn't notice that t was there. Must have missed it when I was editing it. Thank you so much!

Please accept the answer to indicate a solution was found. :slight_smile:
Thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.