[R] knitr and functions generating latex

Yihui Xie xie at yihui.name
Thu Oct 10 06:35:39 CEST 2013


I think in most cases you are probably on the wrong track if you have
to generate LaTeX code for figures from R code (LaTeX tables are
another story), but your case might be different. You did not give a
specific example on why you had to do that, so I cannot give any
advice for now.

My best guess is

<<results='asis'>>=
whatever_your_figure_functions_are()
@

So please provide a minimal example, and avoid indefinite descriptions
like "seems" or "feels like" (in particular, "this should be easy"
made me feel my IQ suddenly dropped by 50%).

Regards,
Yihui
--
Yihui Xie <xieyihui at gmail.com>
Web: http://yihui.name
Department of Statistics, Iowa State University
2215 Snedecor Hall, Ames, IA


On Wed, Oct 9, 2013 at 10:36 PM, Daryl Morris <darylm at uw.edu> wrote:
> Hi,
>
> I have what I think should be a basic question on knitr.  I am just moving
> to knitr, and previously I had created functions which automatically created
> latex wrappers for many (100s) figures.  I also have other functions which
> automatically create pages worth of latex tables.
>
> The knitr method seems to be to write this figure code by hand.
>
> Is there a way to use my pre-existing functions to output latex into the
> .Rnw document?  So far, everything I've tried isn't doing it. (I've been
> modifying the functions to output big strings of latex instead of writing
> files, and trying various methods to print that output into the .Rnw file).
>
> It feels like this should be easy... the output of the R-block is latex.
>
>
> thanks, Daryl
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list