Re: [R] Very simple loop

2011-11-18 Thread John Kane
343 + 0.056437)), G = dpois(x,exp(4.5355343 + 0.1225822))) df1 <- rowSums(mydata) plot(df1) --- On Mon, 11/14/11, Davg wrote: > From: Davg > Subject: [R] Very simple loop > To: r-help@r-project.org > Received: Monday, November 14, 2011, 10:59 AM > I'm very new to R an

Re: [R] Very simple loop

2011-11-14 Thread R. Michael Weylandt
The one included in the standard R installation -- which can be accessed by typing help.start() at your prompt -- is quite good for beginners (and very conveniently located). If you tell us a bit more about yourself, we can help direct you to others as well: specifically, 1) Prior programming expe

Re: [R] Very simple loop

2011-11-14 Thread Davg
Thank you all! It's working perfectly. I will have a look for an online guide. -- View this message in context: http://r.789695.n4.nabble.com/Very-simple-loop-tp4039895p4040291.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r

Re: [R] Very simple loop

2011-11-14 Thread Emilio López
Dear David, You do not need a loop. The vectors are equaly sized, so sum them and then plot the vector with the sums: total <- A+B+C+D+E+F+G plot (total, type="l") Regards, Emilio 2011/11/14 Davg > I'm very new to R and am trying to create my first loop. > > I have: > > x <-c(0:200) > A <- dpo

Re: [R] Very simple loop

2011-11-14 Thread R. Michael Weylandt
But the awesome thing is you don't need a for loop at all thanks to the magic of R's vectorization! This will do it (and much faster than an R level loop would): x = 0:200 # Note that you don't need a c() since you aren't concatenating 0:200 with anything A <- dpois(x,exp(4.5355343)) B <- dpois(x

Re: [R] Very simple loop

2011-11-14 Thread Joshua Wiley
x <-c(0:200) dat <- data.frame( A = dpois(x,exp(4.5355343)), B = dpois(x,exp(4.5355343 + 0.0118638)), C = dpois(x,exp(4.5355343 -0.0234615)), D = dpois(x,exp(4.5355343 + 0.0316557)), E = dpois(x,exp(4.5355343 + 0.0004716)), F = dpois(x,exp(4.5355343 + 0.056437)), G = dpois(x,exp(4.53

Re: [R] Very simple loop

2011-11-14 Thread jim holtman
x <-c(0:200) A <- dpois(x,exp(4.5355343)) B <- dpois(x,exp(4.5355343 + 0.0118638)) C <- dpois(x,exp(4.5355343 -0.0234615)) D <- dpois(x,exp(4.5355343 + 0.0316557)) E <- dpois(x,exp(4.5355343 + 0.0004716)) F <- dpois(x,exp(4.5355343 + 0.056437)) G <- dpois(x,exp(4.5355343 + 0.1225822)) total <- A +

Re: [R] Very simple loop

2011-11-14 Thread Sarah Goslee
Hi, On Mon, Nov 14, 2011 at 10:59 AM, Davg wrote: > I'm very new to R and am trying to create my first loop. > > I have: > > x <-c(0:200) > A <- dpois(x,exp(4.5355343)) > B <- dpois(x,exp(4.5355343 + 0.0118638)) > C <- dpois(x,exp(4.5355343  -0.0234615)) > D <- dpois(x,exp(4.5355343 + 0.0316557))

[R] Very simple loop

2011-11-14 Thread Davg
I'm very new to R and am trying to create my first loop. I have: x <-c(0:200) A <- dpois(x,exp(4.5355343)) B <- dpois(x,exp(4.5355343 + 0.0118638)) C <- dpois(x,exp(4.5355343 -0.0234615)) D <- dpois(x,exp(4.5355343 + 0.0316557)) E <- dpois(x,exp(4.5355343 + 0.0004716)) F <- dpois(x,exp(4.5355343