On Thu, Jul 24, 2003 at 07:10:27PM -0700, Robert Keefe wrote:
> # This I can do:
> > system.time(x <- rnorm(100000))
> [1] 0.07 0.00 0.13 0.00 0.00
>
> # But this I can't:
> > system.time(x <- rnorm(100000); new <- sample(x, 100000, replace=T))
> Error: syntax error
Just use curly braces:
> system.time({x <- rnorm(100000); new <- sample(x, 100000, replace=T)})
[1] 0.11 0.00 0.11 0.00 0.00
> Have I missed something simple?
See above. Another related way is to define a function; you could even use a
'throw-away anonymous' function [1].
Lastly, you probably also want to learn about profiling your code. There is
an introductory article in one of the R News issues.
Regards, Dirk
--
Those are my principles, and if you don't like them... well, I have others.
-- Groucho Marx
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help