| Title: | Open R Objects in 'StatDataViewer' from 'RStudio' |
|---|---|
| Description: | An 'RStudio' addin that sends objects from the R session (data frames, matrices, tables, vectors, lists, time series, functions, models and more) to the 'StatDataViewer' desktop application <https://statdataviewer.com/>. Each object is converted into a plain data frame that the viewer's R data reader can display, or into a text document, written to a temporary file and opened in the running viewer. Objects can be sent with a keyboard shortcut, from the 'Addins' menu, or through View(). |
| Authors: | Xiaoguang Yan [aut, cre] |
| Maintainer: | Xiaoguang Yan <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-10-11 13:07:59 UTC |
| Source: | https://github.com/sashelper/sdv |
Addin: type an object name or expression to open in StatDataViewer
sdv_addin_prompt(default = NULL, error = NULL)sdv_addin_prompt(default = NULL, error = NULL)
default |
Text pre-filled in the prompt. |
error |
Optional error message shown above the prompt. |
With a selection in the editor or console, the selected code is evaluated in the global environment and the result is sent to StatDataViewer. Without a selection, the object name under the cursor is used. If there is nothing usable, a prompt asks for a name or expression.
sdv_addin_view()sdv_addin_view()
Rebuilds x as a plain data frame whose columns only use types the viewer's
R reader understands. Non-automatic row names become a leading row_names
column.
sdv_clean_df(x, row_names = TRUE)sdv_clean_df(x, row_names = TRUE)
x |
A data frame. |
row_names |
Keep non-automatic row names as a column. |
A plain data.frame.
Writes RStudio's keybindings/addins.json (backing up the previous file to
addins.json.bak). Restart RStudio afterwards. The default
Cmd+Shift+V (Ctrl+Shift+V on Windows/Linux) is not used by RStudio's
built-in shortcuts.
sdv_install_shortcut( key = sdv_default_key(), binding = c("sdv_addin_view", "sdv_addin_prompt"), overwrite = FALSE )sdv_install_shortcut( key = sdv_default_key(), binding = c("sdv_addin_view", "sdv_addin_prompt"), overwrite = FALSE )
key |
Shortcut, e.g. |
binding |
|
overwrite |
Take the key even if another addin already uses it. |
Path of the keybinding file, invisibly.
Check that a data frame is safe for StatDataViewer's R reader
sdv_is_clean(df)sdv_is_clean(df)
df |
A data frame. |
TRUE, or FALSE with a "problems" attribute describing why.
Path of RStudio's addin keybinding file
sdv_keybindings_path()sdv_keybindings_path()
File path (may not exist yet).
Open a file in StatDataViewer
sdv_open_file(path)sdv_open_file(path)
path |
File to open (.rds, .txt, .R, or any format the app reads). |
TRUE invisibly; errors with a hint when the app can't be found.
Generic used by sdv_view(). Methods may return a data frame (shown as a
table), a character vector (shown as text) or NULL (nothing to show).
The default method handles data frames, matrices, arrays, tables, time
series, vectors, lists, environments, functions, models and any other object.
sdv_prepare(x, name = "object", ...)sdv_prepare(x, name = "object", ...)
x |
Object to convert. |
name |
Display name. |
... |
Unused. |
Remove a StatDataViewer addin shortcut
sdv_remove_shortcut(binding = c("sdv_addin_view", "sdv_addin_prompt"))sdv_remove_shortcut(binding = c("sdv_addin_view", "sdv_addin_prompt"))
binding |
|
When enabled, View(x) (and clicking the table icon next to an object in
RStudio's Environment pane) opens the object in StatDataViewer. Objects
that are not tabular (functions, lists, environments, ...) still open in
RStudio unless types = "all".
sdv_use_as_viewer(enable = TRUE, types = c("tabular", "all"), quiet = FALSE)sdv_use_as_viewer(enable = TRUE, types = c("tabular", "all"), quiet = FALSE)
enable |
|
types |
|
quiet |
Suppress messages. |
The change lasts for the current R session. To enable it automatically,
add the snippet printed by this function to ~/.Rprofile.
Whether the override is active, invisibly.
Converts x with sdv_prepare(), writes it to a temporary file and asks
StatDataViewer to open it. Data frames, matrices, arrays, tables, time
series, vectors and lists open as data tables; functions, models and other
objects open as text.
sdv_view(x, name = NULL, open = TRUE)sdv_view(x, name = NULL, open = TRUE)
x |
Any R object. |
name |
Name shown in StatDataViewer. Defaults to the expression passed
as |
open |
If |
The path of the written file, invisibly.
## Not run: sdv_view(mtcars) sdv_view(split(iris, iris$Species), "iris_by_species") ## End(Not run)## Not run: sdv_view(mtcars) sdv_view(split(iris, iris$Species), "iris_by_species") ## End(Not run)