[R] Looking for knitr example for beginner (NO RStudio)

Simon Zehnder szehnder at uni-bonn.de
Thu Jul 18 22:14:34 CEST 2013


The executable is in case of knitr always Rscript. 
On a mac it is simply Rscript on windows it is Rscript.exe. This should be on your PATH. If you are not sure, open the Mac Terminal and type Rscript --version. If it does not say "Command not found" all is fine. 

Best

Simon
On Jul 18, 2013, at 10:09 PM, C W <tmrsg11 at gmail.com> wrote:

> http://tex.stackexchange.com/questions/85154/knitr-with-texworks/85165#85165
> 
> In step 3: "add the executable file (step 3)".
> 
> What is the executable file?  Locate package knitr directory path in R?
> 
> Mike
> 
> On Thu, Jul 18, 2013 at 3:56 PM, C W <tmrsg11 at gmail.com> wrote:
>> Actually, I see it at the bottom.  Sorry!
>> 
>> On Thu, Jul 18, 2013 at 3:44 PM, C W <tmrsg11 at gmail.com> wrote:
>>> Hi Simon,
>>> I am on OS X Lion, I have TeXworks, I don't have knitr as an option.
>>> 
>>> How do I install that into TeXworks?  Seems like I have to something
>>> in terminal?
>>> 
>>> Mike
>>> 
>>> On Thu, Jul 18, 2013 at 3:31 PM, Simon Zehnder <szehnder at uni-bonn.de> wrote:
>>>> Hi Mike,
>>>> 
>>>> I found my way with this little blog: http://yihui.name/knitr/demo/editors/
>>>> 
>>>> The .Rnw files are created very well in a Latex editor. Everything else can be easily googled. The command via knitr::knit2pdf works very fine if you use the chunks. If you are trying to compile an Rtex file, this I do not know either (I like the symbols though in for example https://github.com/yihui/knitr-examples/blob/master/005-latex.Rtex). But the .Rnw files are compiled pretty nice in e.g. texmaker, as described in the blog. Use for example this source file: https://github.com/yihui/knitr/blob/master/inst/examples/knitr-minimal.Rnw
>>>> 
>>>> 
>>>> Hope this helps
>>>> 
>>>> 
>>>> Best
>>>> 
>>>> Simon
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> On Jul 18, 2013, at 8:52 PM, C W <tmrsg11 at gmail.com> wrote:
>>>> 
>>>>> How do you create a .Rnw file, in R or LaTex?  I don't think any
>>>>> tutorial mentions it.
>>>>> 
>>>>> btw, I am very new to the terms like markdown, so I don't understand
>>>>> "markdown to HTML".
>>>>> 
>>>>> I am reading here http://biostat.mc.vanderbilt.edu/wiki/Main/KnitrHowto
>>>>> that you need to compile at terminal.  I do not know terminal, is
>>>>> there other ways?
>>>>> 
>>>>> Could you do a video on just "simple" R?  I have seen 3 videos on R
>>>>> Studio including yours.
>>>>> 
>>>>> Mike
>>>>> 
>>>>> On Thu, Jul 18, 2013 at 2:43 PM, Yihui Xie <xie at yihui.name> wrote:
>>>>>> I'm not sure what your question really is. You do not have to use
>>>>>> RStudio, but it will be much easier to get started with RStudio,
>>>>>> because it does a lot of automatic conversion behind the scenes (e.g.
>>>>>> tex to PDF, markdown to HTML, ...). If you want a "pure" solution
>>>>>> without any text editor support, the answer is
>>>>>> 
>>>>>> library(knitr)
>>>>>> knit('your_input_file')
>>>>>> 
>>>>>> For example, knit('foo.Rnw') gives you foo.tex; if you are familiar
>>>>>> with LaTeX, you can mess with this foo.tex now (outside of R).
>>>>>> 
>>>>>> Minimal examples for different document formats are at
>>>>>> http://yihui.name/knitr/demo/minimal/ (you must have read this page),
>>>>>> and more examples at https://github.com/yihui/knitr-examples
>>>>>> 
>>>>>> If you are asking about the internals of knitr, "Luke, use the
>>>>>> source": https://github.com/yihui/knitr Or for a more comprehensive
>>>>>> introduction, see http://www.crcpress.com/product/isbn/9781482203530
>>>>>> 
>>>>>> Regards,
>>>>>> Yihui
>>>>>> --
>>>>>> Yihui Xie <xieyihui at gmail.com>
>>>>>> Phone: 206-667-4385 Web: http://yihui.name
>>>>>> Fred Hutchinson Cancer Research Center, Seattle
>>>>>> 
>>>>>> 
>>>>>> On Thu, Jul 18, 2013 at 11:13 AM, C W <tmrsg11 at gmail.com> wrote:
>>>>>>> Hi everyone,
>>>>>>> 
>>>>>>> I am using package knitr, FIRST TIME.  I don't have access to RStudio.
>>>>>>> 
>>>>>>> Read through Yihui's page, didn't find it helpful.  Stuck on terms
>>>>>>> Rnw, GFM (GitHub Flavored Markdown).  Never used Sweave, so the
>>>>>>> reference is not helping.
>>>>>>> 
>>>>>>> Is there a simple step-by-step example WITHOUT RStudio?
>>>>>>> 
>>>>>>> My question:
>>>>>>> What is the procedure?  The documentation explains the functions, but
>>>>>>> does not say how to operate between R and LaTex.
>>>>>>> 
>>>>>>> Mike
>>>>>>> 
>>>>>>> ______________________________________________
>>>>>>> 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.
>>>>> 
>>>>> ______________________________________________
>>>>> 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