[R] hist function in a for loop

Dzu dizem.uerek at alumni.fh-aachen.de
Tue Jun 18 20:53:53 CEST 2013


Hello 
Thanks for reply

I want to compute several histograms in a for loop.I am trying to set the
binsize constant in the beginning.

#compute the histograms
 for (i in 1:12)
    { 
    binsize <- -20 :20/2

    hist(singlefile$GVC(singlefile$new_id[,i], freq = FALSE,xlab ="Graph i",
col = "pink",main ="Example Histogram", ylim = c(-3.0,3.0)))
    singlefile$GVCmin <- min(singlefile$GVC[1])
    singlefile$GVCmin <- min(singlefile$GVC[1])
    x1 <- seq(-3.0,3.0,by=.01)
    lines(x1,dnorm(x1),col ="black")
    }

I tried also this but it does not do anything. I also tried your proposal ,
but it says that : breaks = binsize  is not allowed.

I think I am totaly far away from that what I want to do with my code .

One single histogram plotting and computing is easy , but if it is in the
loop , by the syntax to feed the function with counter i is not working

Thanks
Dizem




--
View this message in context: http://r.789695.n4.nabble.com/hist-function-in-a-for-loop-tp4669797p4669816.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list