Apply rmarkdown::render() outside the RStudio don't find pandoc

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Apply rmarkdown::render() outside the RStudio don't find pandoc

Walmes Zeviani-3
Hello,

I want to render a Rmd file using rmarkdown::render() function but I'm used
to edit files with Emacs and I open a linux terminal session to compile
this file with knitr::knit2html()

## On the linux terminal.
$ echo "require(knitr); knit2html('teste01.Rmd')" | R --vanilla

I want to use rmarkdown::render instead. When I tried this, with a R
session open in the linux terminal, I get the message

## In a R session inside the linux terminal
> rmarkdown::render("teste01.Rmd")
Error: pandoc version 1.12.3 or higher is required and was not found.

So I open the the teste01.Rmd file in RStudio and clicked on the "knit
HTML" button and it works. The output is bellow.

## Output in the RStudio after clicking on the "Knit HTML" button.

processing file: teste01.Rmd
  |.............                                                    |  20%
  ordinary text without R code

  |..........................                                       |  40%
label: unnamed-chunk-1
  |.......................................                          |  60%
  ordinary text without R code

  |....................................................             |  80%
label: unnamed-chunk-2 (with options)
List of 1
 $ echo: logi FALSE

  |.................................................................| 100%
  ordinary text without R code


output file: teste01.knit.md

*/usr/lib/rstudio/bin/pandoc/pandoc* teste01.utf8.md --to html --from
markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures
--output teste01.html --smart --email-obfuscation none --standalone
--section-divs --table-of-contents --toc-depth 3 --template
/home/walmes/R/x86_64-pc-linux-gnu-library/3.1/rmarkdown/rmd/h/default.html
--css /home/walmes/Dropbox/ridiculas/markdown/ridiculas.css --variable
theme:cerulean --include-in-header
/tmp/RtmpkgSjDp/rmarkdown-str4aee5c225085.html --mathjax --variable
mathjax-url:
https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML
--no-highlight --variable highlightjs=teste01_files/highlight --variable
highlightjs-theme=textmate

Output created: teste01.html

Its possible to see that RStudio call the pandoc that is at
*/usr/lib/rstudio/bin/pandoc/* and not the old version of pandoc in my
system.

I try overcome this by creating an alias
*pandoc='/usr/lib/rstudio/bin/pandoc/pandoc'*, bus this doesn't work.
Someone has any idea to solve this? I want to use rmarkdown::render()
outside the RStudio.

Thanks.
Walmes.

==========================================================================
Walmes Marques Zeviani
LEG (Laboratório de Estatística e Geoinformação, 25.450418 S, 49.231759 W)
Departamento de Estatística - Universidade Federal do Paraná
fone: (+55) 41 3361 3573
skype: walmeszeviani
homepage: http://www.leg.ufpr.br/~walmes
linux user number: 531218
==========================================================================

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Apply rmarkdown::render() outside the RStudio don't find pandoc

Yihui Xie-2
Please check out the instructions here:
https://github.com/rstudio/rmarkdown/blob/master/PANDOC.md

Creating an alias might work, although I have not really tried. What I
have been doing is to uninstall the old version of Pandoc in my
system, and create symlinks following the instructions above. You said

> I try overcome this by creating an alias
> *pandoc='/usr/lib/rstudio/bin/pandoc/pandoc'*, bus this doesn't work.

but you did not describe what "this doesn't work" really means
(whenever you report something that does not work, please attach the
error message so we do not have to imagine what could be wrong).
Anyway, at least you have to let your system know where is
pandoc-citeproc (per instructions above again), which may or may not
be the problem given the missing error message.

Regards,
Yihui
--
Yihui Xie <[hidden email]>
Web: http://yihui.name


On Thu, Aug 28, 2014 at 2:06 PM, walmes . <[hidden email]> wrote:

> Hello,
>
> I want to render a Rmd file using rmarkdown::render() function but I'm used
> to edit files with Emacs and I open a linux terminal session to compile
> this file with knitr::knit2html()
>
> ## On the linux terminal.
> $ echo "require(knitr); knit2html('teste01.Rmd')" | R --vanilla
>
> I want to use rmarkdown::render instead. When I tried this, with a R
> session open in the linux terminal, I get the message
>
> ## In a R session inside the linux terminal
>> rmarkdown::render("teste01.Rmd")
> Error: pandoc version 1.12.3 or higher is required and was not found.
>
> So I open the the teste01.Rmd file in RStudio and clicked on the "knit
> HTML" button and it works. The output is bellow.
>
> ## Output in the RStudio after clicking on the "Knit HTML" button.
>
> processing file: teste01.Rmd
>   |.............                                                    |  20%
>   ordinary text without R code
>
>   |..........................                                       |  40%
> label: unnamed-chunk-1
>   |.......................................                          |  60%
>   ordinary text without R code
>
>   |....................................................             |  80%
> label: unnamed-chunk-2 (with options)
> List of 1
>  $ echo: logi FALSE
>
>   |.................................................................| 100%
>   ordinary text without R code
>
>
> output file: teste01.knit.md
>
> */usr/lib/rstudio/bin/pandoc/pandoc* teste01.utf8.md --to html --from
> markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures
> --output teste01.html --smart --email-obfuscation none --standalone
> --section-divs --table-of-contents --toc-depth 3 --template
> /home/walmes/R/x86_64-pc-linux-gnu-library/3.1/rmarkdown/rmd/h/default.html
> --css /home/walmes/Dropbox/ridiculas/markdown/ridiculas.css --variable
> theme:cerulean --include-in-header
> /tmp/RtmpkgSjDp/rmarkdown-str4aee5c225085.html --mathjax --variable
> mathjax-url:
> https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML
> --no-highlight --variable highlightjs=teste01_files/highlight --variable
> highlightjs-theme=textmate
>
> Output created: teste01.html
>
> Its possible to see that RStudio call the pandoc that is at
> */usr/lib/rstudio/bin/pandoc/* and not the old version of pandoc in my
> system.
>
> I try overcome this by creating an alias
> *pandoc='/usr/lib/rstudio/bin/pandoc/pandoc'*, bus this doesn't work.
> Someone has any idea to solve this? I want to use rmarkdown::render()
> outside the RStudio.
>
> Thanks.
> Walmes.
>
> ==========================================================================
> Walmes Marques Zeviani
> LEG (Laboratório de Estatística e Geoinformação, 25.450418 S, 49.231759 W)
> Departamento de Estatística - Universidade Federal do Paraná
> fone: (+55) 41 3361 3573
> skype: walmeszeviani
> homepage: http://www.leg.ufpr.br/~walmes
> linux user number: 531218
> ==========================================================================

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Apply rmarkdown::render() outside the RStudio don't find pandoc

Walmes Zeviani-3
Yihui,

Thank you so much. I read the PANDOC.md as you suggested and this solved my
issue. I've created the soft-links and then I run in linux terminal

$ echo "rmarkdown::render('teste01.Rmd')" | R --vanilla

R version 3.1.1 (2014-07-10) -- "Sock it to Me"
Copyright (C) 2014 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
... skip ...

> rmarkdown::render('teste01.Rmd')

processing file: teste01.Rmd
  |.............                                                    |  20%

label: unnamed-chunk-2 (with options)
List of 1
 $ echo: logi FALSE

  |.................................................................| 100%
  ordinary text without R code


output file: teste01.knit.md

/usr/local/bin/pandoc teste01.utf8.md --to html --from
markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures
--output teste01.html --smart --email-obfuscation none --standalone
--section-divs --table-of-contents --toc-depth 3 --template
/home/walmes/R/x86_64-pc-linux-gnu-library/3.1/rmarkdown/rmd/h/default.html
--css /home/walmes/Dropbox/ridiculas/markdown/ridiculas.css --variable
theme:bootstrap --include-in-header
/tmp/RtmpW1cQMQ/rmarkdown-str14a07b76054a.html --mathjax --variable
mathjax-url:
https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML
--no-highlight --variable highlightjs=teste01_files/highlight

Output created: teste01.html

Everything works! Thanks you.

W.




        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.