Home > Mobile >  r: paste0 to print blanks in combination with seq()
r: paste0 to print blanks in combination with seq()

Time:09-01

I want to print 4 blanks and 4 percentage values using paste0 and seq(), but cannot get it to work.

Expected output

 ""     ""     ""     ""     "0%"   "25%"  "50%"  "75%"  "100%"

I tried numerous combinations, such as

c(paste0(rep("", 4), paste0(seq(0, 100, 25), "%")))

and

paste0(rep("", 4), seq(0, 100, 25), "%"))

CodePudding user response:

c(rep("", 4), paste0(seq(0, 100, 25), "%"))
#[1] ""     ""     ""     ""     "0%"   "25%"  "50%"  "75%"  "100%"
  • Related