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?
Related
With the option "allow scroll past end of document" on, I like to keep my last line of code in the middle of the editor window, but the last line jumps to the bottom of the screen when I run a line of code. Is there a way to prevent this behavior?
Before running code:
After running code:
After running a line of code, I'd like for the window to still look like the first image.
I am trying to place side by side images in r markdown beamer using the code below.
```{r, out.width='.49\\linewidth', fig.cap='caption', fig.show='hold', fig.align='default'}
knitr::include_graphics(c('figures/yield.png', 'figures/boxplot_yield.png'))
However, the images somehow were vertically stacked, instead of horizontally. Please see the resulted plot below. Any ideas??
When I ran your code with my own pictures, they rendered side by side, you may need to make the pictures a smaller resolution and then your code should do what you want
I'm using RMarkdown on a new installation with RStudio. I'm finding that the inline preview is taking up the top two thirds of the text editor for my rmarkdown file. It's appearing, in addition to showing up inline below each paragraph, on top of the paragraphs.
It makes it hard to code or see any of the other work that I'm doing. The preview is fixed to the top of the screen and it stays there even when I scroll up and down in the document.
I can get rid of the inline preview by clicking clear all output.
I think this is probably a bug, but maybe not. I tried restarting RStudio and the issue persists.
If you go to Tools -> Global Options, a window will pop up. Select "R Markdown" on the left and you should see something like the below:
Half-way through, make sure "Show output inline for all R Markdown documents" is unchecked.
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'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.