On Fri, Jul 5, 2013 at 7:24 PM, peter dalgaard <pda...@gmail.com> wrote:
> I have used in with multi-line input, occasionally, though. As in > > replicate(10000, { > ysim <- rbinom(length(p), n, p) > glm(cbind(ysim, n - ysim) ~ x, binomial)$deviance > }) > > ... and then you realize that you probably don't want to look at 10000 > simulated deviances and add "-> simDev". > Yes, that's kinda cute, but then you realise you don't want to have to type all that again and it would really be better off in a function. Can you do something like: replicate(10000,{ ysim <- rbinom(length(p), n, p) glm(cbind(ysim, n - ysim) ~ x, binomial)$deviance }) -> function()... - I don't think so. Once you've started typing, the only way to get it into a function is going to involve sticking function() at the start, at which point you can add the foo <- I guess this is the point where Dirk gets upset and calls me a troll. I'll shut up. You've convinced me its mostly harmless. Barry ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel