Message-ID: <4006C6F4.5010506@lancaster.ac.uk>
Date: 2004-01-15T16:59:32Z
From: Barry Rowlingson
Subject: empty string
In-Reply-To: <Pine.A41.4.58.0401150842400.16268@homer30.u.washington.edu>
Thomas Lumley wrote:
> paste(rep(" ",n), collapse="")
>
> gives a string of n spaces.
>
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