[R] Trouble defining breaks for weighted histogram

juliannecpayne jpayne at s-3.com
Tue Jul 9 19:37:31 CEST 2013


Hello R users,

I am in the process of creating weighted histograms using NHANES data. I
developed the following language to output my results:

wtd.hist(NHANES$LBXTHG,breaks="Sturges",weight=weight,freq=FALSE,main='Mercury
Histogram (Weighted)',xlab='Blood Mercury',col=200,na.rm=TRUE)

Each time I submit the language, I get an error back stating:

Error in wtd.hist(NHANES$LBXTHG, breaks = "Sturges", weight = weight,  : 
some 'x' not counted; maybe 'breaks' do not span range of 'x'

I'm a bit unclear on why this might be, given that the documentation on
Sturges led me to believe that the breaks would be determined by the range
of the data. Can anyone advise?

I suppose it may be worth mentioning that I am a new R user. I usually
program in SAS.

Best,
Jules




--
View this message in context: http://r.789695.n4.nabble.com/Trouble-defining-breaks-for-weighted-histogram-tp4671176.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list