RStudio hangs on viewing list

When I try to view a list of any decent size, RStudio just shows a blank screen, and after that, although I can enter commands in the console, nothing else can be executed.

The list comes from a group_by, nest(), regression analysis set-up shown below:

# Run regressions based on passed data
# `by_var` is NSE
# reg_formula must be passed from a `as.formula()` object
regress_by <- function(df, by_var, reg_formula) {
  by_var <- enquo(by_var)
  df %>%
    group_by(!!by_var) %>%
    nest() %>%
    mutate(
      lm_obj =  map(data, ~lm(reg_formula, data = .x))
    )
}

test <- regress_by(base, region, reg_form)

My guess is that RStudio chokes on the lm_obj part. Once I make the base data frame small enough RStudio will show test, but it still results in a sluggish experience. The screenshot shows the outcome when base is just shy of 3,000 observations and the regressions were done for 171 factors by region.

Once I make base much bigger than that, RStudio just hangs and I need to do a force quit.

On my system:

Chrome version RStudio/1.2.5042
Operating system Mac OS X 10.15.4
R 3.6.2

Update: I tried this on an RStudio Pro server that I have access (using R 3.6.3 and RStudio 1.2.5033-1) and I ended up crashing that one as well once the sample size became even moderately big (~30,000 observations).

2 Likes

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.