Do you advise r/css/md in separate files, and then use codes in the R file such as the one below to create an html file base on the md and css file and then from the html file convert to pdf file Or is it better to have all of it (r, md, css) in one file such as an Rmd file then just knit it to either html or pdf ?
I like the first choice since is very organized, but how do I incorporate the data in the md file unless it is static but what if I preferred to read an file or data from an external source then how to make the md file adapt to that or how do I use R code in the first scenario to manipulate the data in the md file ? Could you kindly please post an example code for the first scenario.
Maybe the second choice is better and more ideal, I don't know, please advise ?
If you want to mix text and code in publication purposes I would really go with Rmarkdown format instead of trying to reproduce what is does.
In a Rmd file, you'll be able to put text and chunk of code. You'll even able to include inline css if you want using css code chunk (you'll also point to an external css file). When you compile the document what it does is
Converting Rmd to md file, executing all the R code, replacing by the input and result (depending on the knitr option), saving figures for plots, ... This is the work of knitr
Then it will convert md file to html, using css provided. This is the work of pandoc converter.
This works very well, this is pretty powerful and customisable. Unless you have a very strong specifity and con against using Rmarkdown, I would definitely use it.
So I created an R markdown file. Then I Knit it to HTML, that looks fine, html file is produced.
But when I tried to Knit it to PDF, a TEX file appears and not the PDF file.
Not sure why a TEX file is produced, normally a PDF file is produced.
When I use this bottom code I get no result (normally a PDF file is produced):
It is very difficult to help with only these informations. Read the book and follow the advice to understand how it works.
To produce PDF you need to have latex installed. For best working with Rmarkdown features, tinytex is adviced
Otherwise, it should work fllawlessly with last RStudio version and Rmarkdown.
Know that rmarkdown::pandoc_convert() is advanced used and you need to master pandoc as it is just a wrapper to call directly pandoc converter without any of Rmarkdown treatment.
It said NO TEX installation detected (Tex is required to create PDF output).
You should install a recommended Tex distribution for your platform:
windows: MikTEX (Complete) - http: //miktex.org/2.9/setup
(NOTE: Be sure to download the Complete rather than Basic installation)
I thought that if I install tinytex that I don't need MikTEX and it would work.
I use the code to install and also use the code to uninstall. It said TinyTeX does not seem to be installed after trying to install.
And to look for where is install
TinyTeX::uninstall_tinytex()
I get results as “ “
I don’t know if restriction are the reason from it being install.
What the installation says? There is also a reinstall function. It is really hard to debug like that but it is supposed to be easy and it works pretty easily on my side.
If you provide some detailed step and error message we may help.