[R] Plots from categorial data

hadley wickham h.wickham at gmail.com
Sun Jul 1 17:48:44 CEST 2007

On 7/1/07, Christoph Krammer <ck at altaica.de> wrote:
> Hello Hadley,
> Thanks a lot for your help. I got the plot I want out of this module with a
> slightly more complicated command.
> But now, I have an additional problem:
> In the given case, the "filtersetting" column contains letters, so R takes
> the values as categories. But I have other filters, which only have numeric
> categories like "0.125", "0.25", "1", and so on. But there is no real
> "distance" between these values, so the data is still categorial. But if I
> draw a plot from this data, the result is a plot with axis labels like 0.2,
> 0.4, 0.6, ...
> How do I tell R to treat the numbers in the filtersetting column as
> categories?

Just make it a factor:
qplot(factor(filter_setting), avg.hit, data=data, colour=ocrtool, geom="line")


More information about the R-help mailing list