"PD" == Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes:
PD> Thomas Vogels <tov at ece.cmu.edu> writes:
>> Hi,
>>
>> I keep running into this:
>> Error in hist.default(f) : `x' must be numeric
>>
>> To which of course something like (simplified but not beyond
>> repair):
R> hist.factor <- function (ff) {
>> jj <- table (ff) jb <- barplot (jj, ylab="Frequency",
>> xlab=deparse(substitute(ff))) axis (1, jb, names (jj)) }
>> is a possible solution.
>>
>> Why is a 'hist.factor' not part of the base distribution? Is this
>> kind of thing discouraged? Usually not needed? Am I missing sth
>> else?
PD> Well histograms are density estimates defined for continuous
PD> variables. What you're drawing is a barplot. barplot.factor might
PD> be a good idea, though.
Well,
plot(f)
already draws a barplot of a factor f (by the plot.factor method).