Skip to content

empty string

3 messages · Wolski, Thomas Lumley, Barry Rowlingson

#
On Thu, 15 Jan 2004, Wolski wrote:

            
paste(rep(" ",n), collapse="")

gives a string of n spaces.

	-thomas
Thomas Lumley			Assoc. Professor, Biostatistics
tlumley at u.washington.edu	University of Washington, Seattle
#
Thomas Lumley wrote:

            
Is that more or less efficient/faster or slower than using sprintf:

sprintf(paste("%",n,"s",sep='')," ")

  A quick test shows it to take about two-thirds the CPU time of the 
paste(rep()) solution.

  Not that it matters - I cant see something like this ever being a 
significant part of any calculation!

Baz