Is there a simple way to do this in R?
paste0( rep(" ", times=i), collapse="" )
This would be equivalent to Perl's x operator:
" " x $i
I'm hoping for something in the default packages. I would rather not load a package just to do this.
Is there a simple way to do this in R?
paste0( rep(" ", times=i), collapse="" )
This would be equivalent to Perl's x operator:
" " x $i
I'm hoping for something in the default packages. I would rather not load a package just to do this.
Yes, you can use strrep
i <- 10
strrep(" ", i)
#[1] " "