Archived topic
Including R code into a blog post.
3 replies · Started by Zad on December 10, 2018
A lot of my work and blog posts revolve around the R programming language and I want to be able to include R code into my blog posts, kind of in a similar fashion to how this website is able to do so. Does anyone know how this could be implemented in a relatively easy way?
https://www.jaredknowles.com/journal/2013/11/25/getting-started-with-mixed-effect-models-in-r
Hi there,
You could try a plugin like this: https://wordpress.org/plugins/syntaxhighlighter/
Let me know :)
Hmmmm for some reason it seems to automatically change my R code whenever I try to preview it.
For example, I have this code that I try to paste in,
library(intrvals)
GroupA<-runif(1000, min=0, max=100)
GroupB<-runif(1000, min=0, max=100)
GroupA<-rnorm(500)
GroupB<-rnorm(500)
RandomData<-data.frame(GroupA, GroupB)
##bob<-intervals.mean(GroupA, GroupB, RandomData)
rob<-lm(GroupA ~ GroupB, data=RandomData)
bob<-intervals.gen(rob, "GroupB")
v<-plot.p(bob, -0.15, 0.15, 0.01)
v
z<-plot.s(bob, -0.15, 0.15, 0.01)
z
and it'll transform it into this when I try to click "preview"
With the Beaver Builder plug in, it doesn't even seem to show up after I wrap the R code with the tags in the code editor.
Hi there,
when you add your code, try doing it from the text editor (not visual), and whilst there wrap it in the code tag.