51800

opts_current: how does it work in knitr?

I am trying to set up different figure size in different chunks. I first define a global settings using:

opts_chunk$set(fig.width=7, fig.height=7)

Then, for the specific chunks, I use:

opts_current$set(fig.width=7, fig.height=14)

But the later is always neglected. So, how does opts_current really work?

Answer1:

For specific code chunks, put the chunk options in the chunk header, e.g.

```{r fig.width=7, fig.height=14}

These are called local chunk options, which will override global chunk options (temporarily for this specific chunk).

Recommend

  • HTML formatted tables in rmarkdown word document
  • P-values significance not showed in stargazer html regression table
  • After creating an executable ShinyApp when Rendering Rmarkdown Stops in R
  • Can't generate plotly interactive plots in Rmarkdown report
  • Embedding a live updating matplotlib graph in wxpython
  • Invalid rgba arg “#” in matplotlib
  • Using header of chunk to save plot
  • matplotlib's colormap
  • cell spacing in div table
  • XSLT foreach repeating nodes to flat
  • How to create a 2D image by rotating 1D vector of numbers around its center element?
  • Updating Dojo provide
  • Defined variables not working in javascript files when I use getScript
  • blade.php method outputting it's result to the form
  • Thread 1: EXC_BAD_ACCESS (code =1 address = 0x0)
  • How can I display the parent menu item's description using Wordpress walkers?
  • D3 get axis values on zoom event
  • Visual Studio 2010 debugger build correctly - compiler pdb and linker pdb not in synch?
  • How to get Eclipse Oxygen to run on Java 9
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • OpenGL 3.3 on Mac OSX El Capitan with LWJGL
  • Change multiple background-images with jQuery
  • Android screen density dpi vs ppi
  • Azure Cloud Service Web Role web pages do not load
  • How to set/get protobuf's extension field in Go?
  • DirectX11 ClearRenderTargetViewback with transparent buffer?
  • Change an a tag attribute in JavaScript based on screen width
  • How to show dropdown in excel using jrxml (jasper api)?
  • XCode can't find symbols for a specific iOS library/framework project
  • Matrix multiplication with MKL
  • NSLayoutConstraint that would pin a view to the bottom edge of a superview
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • How to set the response of a form post action to a iframe source?
  • How get height of the a view with gone visibility and height defined as wrap_content in xml?
  • What are the advantages and disadvantages of reading an entire file into a single String as opposed
  • Change div Background jquery
  • Qt: Run a script BEFORE make
  • python draw pie shapes with colour filled
  • reshape alternating columns in less time and using less memory
  • Converting MP3 duration time