macOS only. Does not work on Windows or Linux. Opens data in VisiData using the built-in Terminal.app by default (terminal = "terminal"); use terminal = "auto" with MISC_VIEW_TERM / options(misc.view_term) for a configurable choice, or terminal = "iterm" for iTerm2. If the input is an sf object, the geometry column will be dropped before viewing.

view_vd(data, type = "csv", terminal = c("terminal", "auto", "iterm"))

Arguments

data

A data.frame, tibble, or sf object to view

type

Either "csv" or "json" format for writing the temporary file. Use "json" for preserving list-columns.

terminal

Which macOS terminal to use: "terminal" (default) is the built-in Terminal.app; "iterm" forces iTerm2 (new tab if a window already exists, otherwise a new window); "auto" reads the choice from the environment variable MISC_VIEW_TERM and then from options(misc.view_term) — set either to "terminal" or "iterm". If auto finds nothing valid, Terminal.app is used.

Value

Returns the input data invisibly

Details

Platform: Supported only on macOS (Darwin). On Windows or Linux, the function stops with an error. It only performs the VisiData launch in interactive R sessions; in non-interactive sessions it does not open a terminal but still returns the data.

It creates a temporary file and opens it in VisiData in the selected terminal. For terminal = "auto", set MISC_VIEW_TERM (e.g. in ~/.Renviron) and/or options(misc.view_term = "iterm") so VisiData opens in iTerm2 when you are inside tmux or other environments where a fixed default is needed. The temporary filename includes a timestamp for identification.

The VisiData CLI (vd) must be installed and on your PATH (VisiData is a Python package; see https://www.visidata.org/). If an executable named vdk is also on your PATH, it is invoked instead as vdk <project_basename> <file> (a local helper; not shipped with this package); vd is still required.

Examples

# \donttest{
if (interactive()) {
# View a data frame
mtcars %>% view_vd()

# View with custom title
mtcars %>% view_vd(title = "Car Data")

# View with list columns preserved
nested_df %>% view_vd(type = "json")
}
# }