The viewData package is an alternative to the View(...) function. It's a thin wrapper around the DT library.



The motivation to build this package was

  1. to learn how to build r packages and
  2. to view and interact with my data outside of a shiny app.

In my data cleaning and transformation workflow, I like to do spot checks of the data to make sure I understand what the code/functions are doing and to see if there are any potential issues with the underlying data or methods.

The base function View() is nice, but I wanted to incorporate the features in DT (e.g., search, filter, view rows, clickable links, etc.). I also wanted to be able to view the data in a browser window (as opposed to Rstudio) which could then be moved to a second monitor. This would allow me to interact with the data and make adjustments to the code without having to resize the Rstudio panes in order to see the data and code on one line.

Since I built the package, I've found the renderULS argument to be very useful if I'm unfamiliar with dataset and I wanted to know more about a category. This works beautifully in a tidywork flow (see examples below).


The viewData package can be installed using the devtools package.


The only function viewData(...) is a simple wrapper around the DT package and takes the following options (shown below are the default options).

viewData(data, showFilter = FALSE, row.names = FALSE, renderURLS = FALSE, launch.browser = FALSE)


Access keys are also enabled for interacting with table outputs. The current shortcut is for moving the cursor into the search field. This shortcut is:

'accesskey' + t

The combination of keys to enable this functionality varies by browser and OS. See for more information.


Standard use

viewData(data= iris)

Alternatively, you can use viewData::viewData(...)

Adding Filters

viewData(data = iris, showFilter = TRUE)

Print row.names

viewData(data = mtcars, showFilter = TRUE, row.names = TRUE)

View data in browser

viewData(data= iris, launch.browser = TRUE)

Make clickable URLS

# assign to tmp object
df <- iris

# paste urls
df$urls <- paste0('<a href="',df$Species,'">',df$Species,'</a>')

# view
viewData(data= df, renderURLS = TRUE)

Make clickable URLS the tidy way

iris %>%
  mutate(Species = paste0('<a href="',Species,'" target="_blank" rel="noopener">',Species,'</a>')) %>%
  select(Species, everything()) %>%
  viewData::viewData(data = ., showFilter = TRUE, renderURLS =  TRUE, launch.browser = TRUE)


The viewData package relies on the following packages shiny, miniUI and DT. If you run into any errors during the installation or usage, it might be due to missing packages or they are outdated. Run the following lines to install/update these packages, and then reinstall the viewData package


davidruvolo51/viewData documentation built on May 6, 2019, 9:08 a.m.