[R] Reduce/eliminate console printing time?
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Mar 31 20:14:54 CEST 2006
On Fri, 31 Mar 2006, Sean Davis wrote:
> On 3/31/06 12:20 PM, "Toby Daniel Ahrens" <tahrens at stanford.edu> wrote:
>
>> Hi:
>>
>> I have been writing some functions in R that are about 500-1000 lines long,
>> and when I copy and paste the code into the R console, it takes about 20-30
>> seconds for R to ³print² and run the code at the console command line (and
>> this is just for function definition - R isn't actually executing any
>> commands). If I minimize the R console so that it shows only one line at a
>> time, screen ³printing² time can be cut in half, but it would be nice to
>> reduce this further when I am changing the code fairly often. Is there any
>> way to make the code run in R without ever printing each line in the R
>> console (such as printing to a ³back² screen that isn¹t visible)?
>>
>> Thanks very much and waiting impatiently,
>
> See ?source. Just save your R code and then source it.
We haven't been told the OS, but if this is Windows,
source("clipboard")
is all that is needed to invisibly 'paste' code. (The answer to the final
part of the question is ?sink.)
(OTOH, if this is Windows the times seem slow: I just tried pasting 1200
lines of code and timed it at 7 secs, but source("clipboard") was
instant.)
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list