[Resolved] Including R code into a blog post.

Home Forums Support [Resolved] Including R code into a blog post.

Home Forums Support Including R code into a blog post.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #753336
    Zad

    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

    #753349
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You could try a plugin like this: https://wordpress.org/plugins/syntaxhighlighter/

    Let me know 🙂

    #753391
    Zad

    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”

    View post on imgur.com

    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.

    #753612
    David
    Staff
    Customer Support

    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.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.