Message-ID: <39B6DDB9048D0F4DAD42CB26AAFF0AFA076E25@usctmx1106.merck.com>
Date: 2005-04-20T16:13:42Z
From: Liaw, Andy
Subject: Histogram
> From: Mag. Ferri Leberl
>
> Dear everybody!
> I am analysing data from an enquette. The answers are either
> A or B. How can I
> draw a histogram without transforming the data from
> characters to numbers? If
> the data are saved in a list M, hist(M[,1]) returns:
>
> Error in hist.default(M[, 1]) : `x' must be numeric
> Execution halted
You can try:
> hist.factor <- function(x, ...) barplot(table(x), ...)
> f <- factor(sample(c("A", "B"), 50, replace=TRUE))
> hist(f)
HTH,
Andy
> Thank you in advance!