
The Viewer pane is used to display local web content. This is done by accessing the RStudio viewer function definition via getOption(viewer). The Viewer pane can be maximized by passing maximize as the height parameter. The Styles pane can be used to change the image at breakpoints, serving smaller images to mobile devices for better performance. The Element pane is used to add custom HTML or code objects to a page. The Settings pane is used to link stylesheets and other resource files.
| Characteristics | Values |
|---|---|
| Name of the pane | Viewer pane |
| How to access local web content | Accessing the RStudio viewer function definition via getOption("viewer") |
| Customising the height | Use the optional height parameter of the viewer function to request a given height |
| Maximising the pane | Pass "maximize" as the height parameter |
| Running Shiny applications | Use the launch.browser parameter of the Shiny runApp() function |
Explore related products
$74.99 $129.99
$99.99 $149.99
What You'll Learn

Local web content is displayed in the Viewer pane
Local web content can be displayed in the Viewer pane by accessing the RStudio viewer function definition via getOption("viewer"). This approach is front-end agnostic, allowing the user to override the default behaviour if necessary.
The Viewer pane can be maximised by passing "maximise" as the height parameter. This will result in one of the user's other panes being hidden. It is important to note that this value should only be specified when maximum vertical space is essential. When a page is displayed within the Viewer pane, the user may choose to pop it out into a standalone browser window.
Web pages can detect that they are running inside the Viewer pane by looking for the viewer_pane query parameter, which is automatically injected into URLs when they are shown in the Viewer pane. It is also possible to run Shiny applications within the Viewer pane by using the launch.browser parameter of the Shiny runApp() function. This will only work with the Shiny package version 0.8 or later and the httpuv package version 1.2 or later.
Callers are encouraged to automatically scale their content to the current size of the Viewer pane to provide a good user experience. For example, a JavaScript plot can be re-rendered with new dimensions when the size of the pane changes.
Wilton Large Cookie Pan: What Size?
You may want to see also
Explore related products
$89.99 $129.99
$169.99 $299.99

The RStudio viewer function definition is accessed via getOption(viewer)
The RStudio viewer function allows users to view local web content in the Viewer pane. This can be achieved by accessing the RStudio viewer function definition via getOption("viewer").
The RStudio viewer function is used to display local web content within the RStudio environment. It provides a way to view web pages or applications that are running on the user's local machine. By using the viewer function, users can specify the URL of the local web content they want to display, such as "http://localhost:8000" or "http://localhost:8100".
The viewer function also offers the ability to set a desired height for the Viewer pane. This can be done by using the height parameter, which allows users to request a specific height for the pane. For example, requesting a minimum height of 500 pixels can be achieved by using code like "viewer("http://localhost:8100", height = 500)". However, it is important to note that the request may not always be satisfied, as RStudio ensures that the resizing of the Viewer pane does not make any other panes smaller than 160 pixels.
In addition to viewing local web content, the RStudio viewer function also supports running Shiny applications within the Viewer pane. This can be accomplished by using the launch.browser parameter of the Shiny runApp() function. However, it requires the shiny package version 0.8 or later and the httpuv package version 1.2 or later. By installing these packages and using the appropriate code, users can run Shiny applications directly within the Viewer pane.
The RStudio viewer function definition, accessed via getOption("viewer"), provides a flexible way to view local web content and run applications within the RStudio environment. It allows users to specify the URL of the local content and adjust the height of the Viewer pane to suit their needs. Additionally, the front-end agnostic nature of the viewer function enables users to override the default behavior and implement alternative internal viewers if needed.
Heating Milk in a Pan: A Quick Guide
You may want to see also
Explore related products
$119.99 $149.99

The height of the Viewer pane can be adjusted
The RStudio Viewer pane can be used to watch local web content. This includes web graphics generated using packages like googleVis, htmlwidgets, and rCharts, or even a local web application created using Shiny, Rook, or OpenCPU. The Viewer pane can only be used for local web content, which can be static HTML files or locally run web applications.
To request a specific height, you can use code to specify a desired height in pixels. For example, to request a minimum height of 500 pixels, you can use the following code:
> rstudioapi::viewer("http://localhost:8100", height = 500)
However, it is important to note that requesting a large height may hide one of the user's other panes. Therefore, it is generally better to request less height unless your content absolutely requires more vertical space.
It is also possible to request that the Viewer pane be maximized by passing "maximize" as the height parameter. This will force the Viewer to full height, filling all vertical space. However, this value should only be specified when maximum vertical space is essential, as it will result in one of the other panes being hidden.
The Art of Spicy Hot Pot: A Guide to Making Your Taste Buds Dance
You may want to see also
Explore related products

It's possible to run Shiny applications within the Viewer pane
The Viewer pane in RStudio can be used to watch local web content. It is possible to run Shiny applications within the Viewer pane by using the launch.browser parameter of the Shiny runApp() function. This works with the shiny package version 0.8 or later and the httpuv package version 1.2 or later.
To run a Shiny application within the Viewer pane, you can use code such as runApp("MyAppDir", launch.browser = rstudioapi::viewer). This will prevent the app from opening in a new window or an external browser. If you want to set these options globally, you can add a conditional guard to check that RStudio is running first.
The Viewer pane can be resized, and it is recommended that content is automatically scaled to fit the current size of the pane. If your content requires more vertical space, you can request that the Viewer pane be maximized by passing "maximize" as the height parameter. However, this will result in one of the user's other panes being hidden, so it should only be specified when necessary.
When a page is displayed within the Viewer pane, the user has the option to pop it out into a standalone browser window.
Steel Pans: All-Clad vs Carbon
You may want to see also
Explore related products

Web pages can detect if they're running inside the Viewer pane
The Viewer pane in RStudio can be used to watch local web content. Local web content can be displayed in the Viewer pane by accessing the RStudio viewer function definition via getOption("viewer"). The Viewer pane can only be used for local web content, which can be either static HTML files written to the session temporary directory or a locally run web application.
For example, a package could use the following code to show content in the viewer when it's available but default back to the system browser when it's not:
> viewer <- getOption("viewer")
> if (!is.null(viewer)) viewer("http://localhost:8100") else utils::browseURL("http://localhost:8100")
If the web content or application you are displaying benefits from a minimum height, or would like to occupy as much height as possible, then you can use the optional height parameter of the viewer function to request a given height. For example, passing "maximize" as the height parameter will force the Viewer to full height. However, this value should only be specified when maximum vertical space is essential, as it will result in one of the user's other panes being hidden.
Stir-Frying Secrets: The Perfect Pan Temperature
You may want to see also
Frequently asked questions
Local web content is displayed in the Viewer pane.
You can access the Viewer pane by using the RStudio viewer function definition via getOption("viewer").
Yes, it is possible to request that the Viewer pane be maximised. You can do this by passing "maximise" as the height parameter.



























