Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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

and

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

>Solution :

c(rep("", 4), paste0(seq(0, 100, 25), "%"))
#[1] ""     ""     ""     ""     "0%"   "25%"  "50%"  "75%"  "100%"
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading