Hello there! When I do freq=F on hist, I get on the left a small number, what exactly does that mean? Thanks, Martin
Martin Klaffenboeck wrote:> Hello there! > > When I do freq=F on hist, I get on the left a small number, what exactly > does that mean? > > Thanks, > Martin > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > >Did you look at ?hist, which states: freq: logical; if 'TRUE', the histogram graphic is a representation of frequencies, the 'counts' component of the result; if 'FALSE', _relative_ frequencies ("probabilities"), component 'density', are plotted. Defaults to 'TRUE' _iff_ 'breaks' are equidistant (and 'probability' is not specified). So freq = FALSE plots relative frequencies (probabilities). Please read the posting guide and look at the help for the function you are using and trying to understand. HTH Gav -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way [W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson wrote: <snip>> freq: logical; if 'TRUE', the histogram graphic is a representation > of frequencies, the 'counts' component of the result; if > 'FALSE', _relative_ frequencies ("probabilities"), component > 'density', are plotted. Defaults to 'TRUE' _iff_ 'breaks' > are equidistant (and 'probability' is not specified). > > So freq = FALSE plots relative frequencies (probabilities).Careful! You left out the quote marks on ``probabilities''. These are ***CRUCIAL*** inasmuch as the values are NOT probabilities, but rather probability ***densities***. Which, as I recall Bill Venables once pointed out to me, is the only thing that makes sense. If you are doing a histogram, you are looking at a continuous random variable. If the variate in question is discrete, so that you ***really*** want probabilities, you should be doing a barplot. cheers, Rolf Turner rolf at math.unb.ca
Hello, I have three sample, for example a<-c(10,20,10,20,30) b<-c(10,20,20,30,30) c<-c(20,20,10) I would like to have only one histogram with these series, I try the following code: hist(a) hist(b,add=TRUE,col="red") hist(c,add=TRUE,col="green") but it's not that I want I would like an histogram with, from left to right, count of "10" for "a", count of "10" for "b", count of "10" for "c", count of "20" for "a", count of "20" for "b", ... not overlapped Thanks -- ---------------- Alexandre DEPIRE INRETS / GARIG Tel.: (+33) 01 47 40 71 66 Fax: (+33) 01 45 47 56 06 2 av. du g??n??ral Malleret-Joinville 94114 Arcueil - France