All, Is it possible to publish a R Markdown from JSL ?
Provided the current R support functions - I don't know how to achieve that. However, has anybody explored this so far ?
Your R code would look the same, so this should work provided you already installed knitr or rmarkdown:
Names default to here( 1 ); R Init(); R Submit( "\[ library( knitr ) setwd( "C:/temp" ) write( "## My Markdown File Let's add: ``` {r} 1 + 1 ``` ", "myrmarkdown.rmd" ); knit( "myrmarkdown.rmd", output = "mymarkdown.md" ) knit2html( "myrmarkdown.rmd", output = "mymarkdown.html" ) ]\" ); Open( "C:/temp/mymarkdown.html" );
For anyone unfamiliar with what that will look like, here is the html output:
@ih, A follow -up question - Would the format be any different to publish a Latex document ?
Every tutorial I find on Latex is guiding that the document should be a "Sweave" or a text file that is saved as a ".tex"
Is there another way about it ?
I am far from an expert here but I am certain it is possible to convert a .rmd to a .md to a .tex to a .pdf as I am pretty sure that is rmarkdown's standard workflow. The why's and hows should be in the rmarkdown documentation. If you can figure out the steps required to call pandoc_convert (page 41) that should let you save the .tex file, getting you from .rmd to .tex.
If you just want to 'publish' a .tex to .pdf I think you can skip R entirely and call MiKTeX (actually pdflatex) directly using RunProgram() in JSL. I have not tried this but it might be as simple as:
//Untested Code RunProgram( "pdflatex.exe", options( {"mymarkdownfile.tex"} ) )
Hi,
How do you add thinks like title, author to the R Markdown as part of your example. I tried to add that in Write() section but got an error. I appeciate your help. Thanks