[R] coerce data.frame with table-like data to a table for use with barchart.table

Dr Carbon drcarbon at gmail.com
Mon Nov 17 21:40:39 CET 2008


I have a data.frame containing survey data that is already organized
like a table:

> foo
           Excellent Very Good Good Fair Poor Very Poor
Question 1         8         7    3    0    0         0
Question 2         5         5    7    1    0         0
Question 3         7        10    1    0    0         0
> class(foo)
[1] "data.frame"
>

I would like to make a barchart (or stripplot) with three barcharts,
one for each row in the data.frame foo. It seems like I have to coerce
foo to class table to use with barchart.table in lattice but a simple
as.table yields no fruit. Any help appreciated.



More information about the R-help mailing list