I want to add an image in the middle of R markdown report, but when I knit it to pdf, the image appears on the top of the page, not in the intended place. Here is what I use in R markdown:
![help_dataframe_screenshot](help_dataframe_screenshot.png)
Anyone knows how to fix it? I need the image at where I insert it, not on the page top.
I have code-blocks that I want wrapped in a R bookdown format. I am rendering to gitbook. All the code-blocks currently don't wrap, instead they give a horizontal scroll bar.
When I take the same code-block, and render it in a regular RMarkdown file to html, code-wrapping works instantly.
I know that when you want to force a certain character-width, you can so using the answers provided here. But this doesn't work either.
Is this a limitation of the gitbook format? Is there any way to work around it?
I'd like to prevent the R source code of my R notebook not only from not being displayed, but I want it to disappear from the html file entirely. Same for the [CODE] button in the top right corner.
So far, I've only found
code_folding: hide
but it only collapses the code, or
echo=FALSE
in the chunk options, but this does not make the button at the top go away.
Any ideas?
I'm trying to use the knit2wp() function of knitr in order to blog to Wordpress as discussed here: http://yihui.name/knitr/demo/wordpress/
My problem is that, despite trying various options to control chunk width, including setting tidy.opts in the chunk options, and adjusting global width settings as seen here, my R code chunks won't wrap around, resulting in overly wide code chunks that require scrolling sideways to view them, like this.
Is there a setting that I'm missing that will cause R code chunks to wrap around? Also, is there a setting that will widen the grey boxes that appear in Wordpress for the code chunks? None of the width options seem to have any effect.
This is what my setup chunk currently looks like:
```{r setup, echo=FALSE}
library(knitr)
opts_knit$set(upload.fun = function(file) imgur_upload(file, key = "xxxx"))
opts_chunk$set(fig.width=5, fig.height=5, fig.align = 'center', cache=TRUE, tidy = FALSE)
````
I have also tried adding the line options(width = 80) to that chunk, as well as setting tidy.opts within each chunk, and none of these has had any effect.
As a dirty fix, you may add word-wrap: break-word; in css file to your pre element. Or embed it to a html file.
EDIT1:
Final advise is on the bottom. I am not an expert in WP, so you will have to work out the solution yourself.
As for how it will look, you may try it in a browser. There is an example with this page. You choose the element and may see a style on left. You may fix it in your browser (Right click, then "Inspect element" in Chrome) to see how it will look. However, this is not a permanent change: you change your local version. Refresh the page to get back to original.
Now I turn word wrapping off (better change it to break-word):
If you satisfied with result of in-browser if, there are to options to make change it in server:
If we play dirty anyway, you may embed the style tag into your template somewhere. Wrap it in a style tag (Editor removes them, so i am not able to post it):
pre {word-wrap: break-word}
Edit you css and either create a new class or fix the ones that you have. I ma not sure how to do it with wordpress, but there is some information here: https://wordpress.org/support/topic/how-to-edit-css-style-sheet
I believe that the right approach is the second, but if you want result ASAP, you may try the first one as it looks easier.
I would like to see the output be auto wrapped, otherwise long comments would exceed the line width and result in extra horizontal scroll bar in the runtime output window.
I know I can achieve that in the official R GUI, but in the TextMate Bundle I don't know how to do it.
There is a View/SoftWrap option. Is that what you are seeking?