Skip to content

Interactive viewers

Nathan Kim edited this page Dec 15, 2021 · 9 revisions

With R session watcher enabled, multiple types of viewers are supported to display tabular data, graphics, htmlwidgets and shiny apps.

Data viewer

View() will open a tab to view the object.

Object type Viewer
data.frame table viewer
matrix table viewer
list list viewer
environment list viewer
others text editor

Table viewer

The table viewer supports sorting and searching.

image

List viewer

The list viewer supports collapsing nodes.

image

Plot viewer

Graphics could be displayed in native X11/XQuartz window, or as a PNG file in VS Code window, or in a plot viewer based on httpgd device. For more details, go to https://github.com/REditorSupport/vscode-R/wiki/Plot-viewer.

plot-viewer

Webpage viewer

In R, an htmlwidget is written in HTML and can be presented in a web browser. For example, the following image demonstrates an interactive graphics created by plotly:

webpage-viewer

Browser viewer

Interactive shiny apps can be displayed in VS Code. The following is an example created by

shiny::runExample("01_hello")
browser-viewer

For security reasons, the VS Code WebView has security limitations on its capability of accessing external resources over a network. For more details, visit WebView API.

If you encounter a problem loading a webpage in a browser viewer, you may try viewing the web page in an external web browser.

Help viewer

The web pages in R documentation can be viewed in the help viewer. Syntax highlighting and link navigation are supported.

Help viewer could be revealed via ?symbol in R terminal, or from the Help pages viewer in the sidebar, or via command R: Open help for selection in either command palette or context menu in the editor.

help-viewer