Is there a way to knitr and produce .rmd files using the external tools function of the StatET Eclipse plugin? Is there a way to knitr and produce .rmd files using the external tools function of the StatET Eclipse plugin? r r

Is there a way to knitr and produce .rmd files using the external tools function of the StatET Eclipse plugin?


One way to do it is to use an R snippet:

1) create a stateET R project, with this file https://raw.github.com/yihui/knitr-examples/master/001-minimal.Rmd in it.

2) in Windows-> Preferences -> StatET -> Run/Debug -> R Code Snippets

click "Add...". to create a new snipped called Rmd2html.content of the snippet:

file <- "${selected_resource_loc}"if (!nzchar) stop('Select a file first')library(knitr)library(markdown)library(tools)md_file <- knit(file)html_file <- paste(file_path_sans_ext(md_file), '.html', sep = '')markdownToHTML(md_file, html_file)

click "OK", "OK".

3) back in your project, in the Project Explorer view, right click on the minimal.Rmd file,and select "Run Code Snippet in R -> Rmd2html"

This should generate the minimal.html file.