Try the textplot function in the gplots package:

nf <- layout(matrix(1:2), height = lcm(12))
par(mar = c(2, 8, 2, 2))
barplot(prop.table(example.table, 1), beside = TRUE)
textplot(round(prop.table(example.table, 1), 2), halign = 'left',
         mar = c(0,0,0,0), show.colnames = FALSE, cex = 2,
         cmar = 5)


On Fri, Sep 11, 2009 at 3:20 PM, Andy Choens <andy.choens@gmail.com> wrote:

> I am trying to automate a report that my company does every couple of years
> for the state of Maine. In the past we have used SPSS to run the data and
> then
> used complicated Excel template to make the tables/graphics which we then
> imported into Word. Since there are 256 tables/graphics for this report,
> this
> work flow is a little painful. I would like to automate the process and I
> think
> I can do so with odfWeave and R, but I've run into a problem. I can't seem
> to
> get the output from R to look like what we have used in the past. Here's an
> example of what I need it to look like (sorry for the long URL)
>
> http://1.bp.blogspot.com/_TRRvdLHNnE8/SqpP5gFG3DI/AAAAAAAABgY/09x-
> LoLtfTI/s1600-h/example+graphic.png<http://1.bp.blogspot.com/_TRRvdLHNnE8/SqpP5gFG3DI/AAAAAAAABgY/09x-%0ALoLtfTI/s1600-h/example+graphic.png>
>
> My boss is open to using another tool (R) to get the work done but my final
> output needs to look, more or less, like what we did last time.
>
> I can make a table and I can make a bar graph that, essentially gets me
> where
> I want to go (I can handle the tweaking) but I don't know how to put them
> together and make things line up, as in my example (URL).
>
> I have looked at iplot, ggplot, lattice, etc. I will confess that my
> knowledge
> of R's graphical capabilities leaves a lot to be desired (as I am proving
> today) but I really can not find an example or feature that seems to do
> what I
> am trying to do. I am more or less satisfied with the plot, but I really
> would
> like to line up the table with the graphics, which is why I don't just put
> a
> table under the graph via odfweave.
>
> Here's what I have thus far:
>
> ###################################################
> # These numbers are just BS I made up.
> counties <-
>
> c("County1","County2","County1","County2","County1","County2","County1","County2","County1","County2","County1","County2","County1","County2","County1","County2","County1","County2","County1","County2","County1","County2","County1","County2")
>
> gender <- c("Male", "Male","Male", "Male", "Male", "Female","Female",
> "Female","Male", "Male","Male", "Female","Male", "Female","Male",
> "Female","Male", "Female","Female", "Female","Male", "Female","Male",
> "Male")
>
> weight <- c(1,2,1,2,1,2,2,1,1,2,1,2,1,2,1,2,1,2,1,2,1,2,1,2)
>
> example.table<-xtabs(weight~counties+gender)
> barplot(prop.table(example.table,1),beside=T)
> ###################################################
>
> I am open to using any of the various graphics systems provided in R. I am
> willing/capable of learning and in fact, I want to learn how to do this but
> I
> can't even figure out which system I should spend my time learning more
> about
> and I don't have time to become an expert with all of them.
>
> Thank you.
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[alternative HTML version deleted]]


