[R] hist in a for loop

Rui Barradas ruipbarradas at sapo.pt
Tue Jun 18 22:47:41 CEST 2013


Hello,

Please post to the list, like this the odds for more and better answers 
are greater.

I don't understand what you want with

singlefile$GVC(singlefile$new_id[,i]

singlefile$GVC is a function?

How do you plot one single histogram? Post the code and maybe it will 
become more clear.

Rui Barradas

Em 18-06-2013 21:04, Dizem Uerek escreveu:
> 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
> Mit freundlichen Gruessen
> Best Regards
> Dizem Uerek
>



More information about the R-help mailing list