Reputation: 2797
I would like to setup a homepage and publish several R code mixed with text, pictures and references. Obviously that's what a lot of people do:
https://feliperego.github.io/blog/2015/10/23/Interpreting-Model-Output-In-R
https://yihui.org/knitr/demo/wordpress/
http://3.14a.ch/archives/2015/03/08/how-to-publish-with-r-markdown-in-wordpress/
RWordPress does not seem to support graphical outputs from the script. Instead of discussing the multitude of errors I received and options I tried, my simple question is: How did the above listed examples manage to put R code and graphs on their websites? (I haven't tried to contact those homepage owners, but this will be the next step, if no explanation can be found.)
Upvotes: 0
Views: 787
Reputation: 6226
You have several options. It depends if you want to build your website from scratch or not. In the first case, I recommend you to have a look at:
bookdown
: very nice for documentation. You can find many examples on the web, for instance the bookdown documentationblogdown
: more general than bookdown
. This gives very nice websites (mine is built using blogdown
for instance). blogdown
is based on hugo
: you can find many themes.In both cases, you write standard Rmarkdown
and build your site by executing the markdowns. You can build the site locally for preview or deploy them on the web (manually or by a continuous integration system as gitlab pages). The point of using these packages is reducing the burden of handling formatting and links between pages.
Upvotes: 2
Reputation: 1294
The short answer is a mixture of manual and automatic generation. If you look at my website (www.jamescurran.co.nz), you'll find articles like the ones you want to write.
I achieve this in a variety of ways. Sometimes I get knitr to produce the HTML, and then I hack it into shape on the website. Other times, I use a mixture of short-tags like
[code language = "R"]
data(cars)
[/code]
and/or HTML like
<pre><code>
data(cars)
</code><pre>
The images I upload and then use Wordpress' editor to insert the correct links. It's not very satisfactory, but unless you have a hosting platform that allows you to have static content, then most of the automated solutions that go straight from R Markdown won't work.
Upvotes: 1