View: View (without crashing Rstudio)

View source: R/View.R

ViewR Documentation

View (without crashing Rstudio)

Description

R's View() always tries to open any object; but some common objects make Rstudio crash or slow things down. This function is designed to mask the default View(). This version removes by default any list-columns, including geometry columns from data.frame objects. It also blocks viewing large dataframes.

Usage

View(x, title = NULL, block_large_df = TRUE, rm_lc = TRUE)

Arguments

x

An R object

title

An optional title chosen for the window that will display the object

block_large_df

Should large dataframes be blocked from displaying?

rm_lc

Should list-columns be removed?

Details

Global options can be set to alter behaviour:

  • "cpview_mblim": an integer for maximum dataframe size in Mb (rough approximation)

  • "cpview_celllim": an integer for maximum number of dataframe columns

  • "cpview_warn": anything but 'NULL' to silence warnings when removing list-columns

Value

Both the object (invisibly) and its display

Examples

iris_same <- iris %>%
  mutate(listcol = purrr::map(Petal.Width, ~`+`(Petal.Length, .x))) %>%
  as_tibble() %>%
  View()

iris_same

AltfunsMA/cptools documentation built on Aug. 7, 2022, 5:44 p.m.