On Fri, Jul 3, 2015 at 2:59 PM, Rich Shepard <[email protected]> wrote:
> On Fri, 3 Jul 2015, Scott Kostyshak wrote:
>
>> Let's take this step-by-step. First, I strongly recommend using knitr over
>> Sweave (this is not just a personal preference). If you go to Help >
>> Specific Manuals > Knitr and compile, does it work?
>
>
> Scott,
>
>   Interesting. I'll take a little time to try this, but after a lot more
> research I believe that I indentified the problem: Sweave (at least) wants
> to run R code to produce a result ,such as str() and summary(), rather than
> using a data.frame already generated by R.
>


>   A quick test will tell me if knitr behaves differently.
>
>   The results I want to include in the document have already been calculated
> and I have them in the cwd as records of each day's R session. They just do
> not cleanly paste into the LyX document; the \n seem to be lost and I need
> to clean up the text. The idea was to have Sweave nicely format the results
> in the document, even putting them in a table for me.
>
Copy/paste is a bad idea, and not very practical at that (but if you must,
your probably want to do it in a LyX-code environment, at which point
the Sweave/knitr modules are irrelevant). If you have the results
already ready, then what you generally want to do is:
load(".RData")

or whatever the name of your saved workspace, and then use one of packages
xtable, stargazer or Hmisc::latex to neatly format your tables in
LaTeX and place them in your LyX document. If you use Chunks, you want
indeed to insert valid R code exclusively.

Liviu



> Thanks for the suggestion,
>
> Rich



-- 
Do you think you know what math is?
http://www.ideasroadshow.com/issues/ian-stewart-2013-08-02
Or what it means to be intelligent?
http://www.ideasroadshow.com/issues/john-duncan-2013-08-30
Think again:
http://www.ideasroadshow.com/library

Reply via email to