Hannah Lee
Hannah Lee

Reputation: 75

How can I concatenate vectors in loop in R

everyone

I brought some new trivial questions to ask. I've searched, but I failed to look for the most efficient answer.

The string(or list) I would like to make looks like:

c("who","expr1","who","expr2",...,"who","expr100")

How can I efficiently make this string using loop(or another function) in R?

Thank you~!!

Upvotes: 2

Views: 1168

Answers (1)

Zheyuan Li
Zheyuan Li

Reputation: 73265

At least this is one choice:

c(rbind("who", paste0("expr", 1:100)))

Upvotes: 3

Related Questions