There are many ways of formatting R code, tables and graphs for publishing.
R users often want to publish analysis and results in a reproducible way. See Reproducible R for details.