Testing Figures

-June 12, 2015

I’m not sure if I’m doing figures right.


  faithful %<>%
    mutate(clust = kmeans(., centers = 2) %>% extract2("cluster") %>% factor())

  ggplot(faithful, aes(waiting, eruptions, color = clust))+



So, I had to get knitr to save the figure file to one directory, but call it another in the code. That is, knitr would insert this line into the markdown:

![alt text](//jofrhwld.github.io/blog/figs/figure.png)

And what I needed it to insert was

![alt text]({{ site.baseurl }}/figs/figure.png)

So I just hacked the hell out of it by reading in the output of render_jekyll(), doing a regex substition, and writing it back out again.

It’s so ugly. You can check it out here: https://github.com/JoFrhwld/blog/blob/gh-pages/knit_post.R#L7

posted by Joe at 17:30 (more or less).

blog comments powered by Disqus