Performance Issues with View() for large data frames RStudio Preview Version 1.2

Same issue with RStudio 1.1.463

Can you please try the preview release and let us know if the situation appears improved there?

Hi Kevin,

Yes, it improved in two ways when I View()ed large and complex dataframes:

  • It was hanging RStudio for several minutes, it not hangs anymore (although I noticed a tiny delay < 5 sec, but that is ok)

  • the navigation within the window became much smoother

Regards

Dear Kevin,

Yesterday I upgraded RStudio to Version 1.2.1114, Build 1150 (2e0f7658).

My code runs without any issues to its end, but if I try to View (dt_all_cells.nest) RStudio hangs, forcing me to abort RStudio.

The structure of dt_all_cells.nest follows below:

> str(dt_all_cells.nest)
Classes ‘tbl_df’, ‘tbl’ and 'data.frame':	5 obs. of  3 variables:
 $ file    : chr  "C://Users//fabio//OneDrive//Tecknowledge//ABSOLAR//Financiamento//CCEE-Res-Cons/Resultado_Consolidado_Publicacao_agosto18.xlsx" "C://Users//fabio//OneDrive//Tecknowledge//ABSOLAR//Financiamento//CCEE-Res-Cons/Resultado_Consolidado_Publicacao_agosto18.xlsx" "C://Users//fabio//OneDrive//Tecknowledge//ABSOLAR//Financiamento//CCEE-Res-Cons/Resultado_Consolidado_Publicacao_agosto18.xlsx" "C://Users//fabio//OneDrive//Tecknowledge//ABSOLAR//Financiamento//CCEE-Res-Cons/Resultado_Consolidado_Publicacao_agosto18.xlsx" ...
 $ sheet_sn: chr  "Resultado Consolidado" "Resultado Comprador" "REH 1.410_2013" "Resultado Vendedor" ...
 $ data    :List of 5
  ..$ :Classes ‘tbl_df’, ‘tbl’ and 'data.frame':	1303752 obs. of  7 variables:
  .. ..$ sheet    : chr  "Resultado Consolidado" "Resultado Consolidado" "Resultado Consolidado" "Resultado Consolidado" ...
  .. ..$ row      : int  1 1 1 1 2 2 2 3 5 7 ...
  .. ..$ col      : int  6 9 18 19 1 9 15 3 2 3 ...
  .. ..$ data_type: chr  "character" "character" "character" "character" ...
  .. ..$ numeric  : num  NA NA NA NA NA NA NA NA NA NA ...
  .. ..$ date     : chr  NA NA NA NA ...
  .. ..$ character: chr  "" "" "" "" ...
  ..$ :Classes ‘tbl_df’, ‘tbl’ and 'data.frame':	20350 obs. of  7 variables:
  .. ..$ sheet    : chr  "Resultado Comprador" "Resultado Comprador" "Resultado Comprador" "Resultado Comprador" ...
  .. ..$ row      : int  3 5 7 8 8 8 8 8 8 8 ...
  .. ..$ col      : int  2 2 2 2 3 4 5 6 7 8 ...
  .. ..$ data_type: chr  "character" "character" "character" "character" ...
  .. ..$ numeric  : num  NA NA NA NA NA NA NA NA NA NA ...
  .. ..$ date     : chr  NA NA NA NA ...
  .. ..$ character: chr  "Resultado Original dos Leilões de Energia Elétrica - Resumo Comprador" "Importante: O conteúdo desta publicação foi produzido pela CCEE com base em dados e informações de conhecimento"| __truncated__ "Obs: Nesta planilha, não constam resultados de leilão de ajuste." "ID Resultado Comprador" ...
  ..$ :Classes ‘tbl_df’, ‘tbl’ and 'data.frame':	37273 obs. of  7 variables:
  .. ..$ sheet    : chr  "REH 1.410_2013" "REH 1.410_2013" "REH 1.410_2013" "REH 1.410_2013" ...
  .. ..$ row      : int  3 5 7 7 7 7 7 7 7 7 ...
  .. ..$ col      : int  2 2 2 3 4 5 6 7 8 9 ...
  .. ..$ data_type: chr  "character" "character" "character" "character" ...
  .. ..$ numeric  : num  NA NA NA NA NA NA NA NA NA NA ...
  .. ..$ date     : chr  NA NA NA NA ...
  .. ..$ character: chr  "REH 1.410_2013" "Importante: O conteúdo desta publicação foi produzido pela CCEE com base em dados e informações de conhecimento"| __truncated__ "ID \r\nNegociação" "Leilão\r\n(1)" ...
  ..$ :Classes ‘tbl_df’, ‘tbl’ and 'data.frame':	40295 obs. of  7 variables:
  .. ..$ sheet    : chr  "Resultado Vendedor" "Resultado Vendedor" "Resultado Vendedor" "Resultado Vendedor" ...
  .. ..$ row      : int  2 3 5 7 8 8 8 8 8 8 ...
  .. ..$ col      : int  2 2 1 1 1 2 3 4 5 6 ...
  .. ..$ data_type: chr  "character" "character" "character" "character" ...
  .. ..$ numeric  : num  NA NA NA NA NA NA NA NA NA NA ...
  .. ..$ date     : chr  NA NA NA NA ...
  .. ..$ character: chr  "" "Resultado Original dos Leilões de Energia Elétrica - Resumo Vendedor" "Importante: O conteúdo desta publicação foi produzido pela CCEE com base em dados e informações de conhecimento"| __truncated__ "* Nos leilões de projetos estruturantes (UHE Santo Antônio, UHE Jirau e UHE Belo Monte) não houve definição de "| __truncated__ ...
  ..$ :Classes ‘tbl_df’, ‘tbl’ and 'data.frame':	632 obs. of  7 variables:
  .. ..$ sheet    : chr  "MDER" "MDER" "MDER" "MDER" ...
  .. ..$ row      : int  1 1 1 1 2 2 3 5 7 7 ...
  .. ..$ col      : int  6 9 16 17 1 9 3 2 2 3 ...
  .. ..$ data_type: chr  "character" "character" "character" "character" ...
  .. ..$ numeric  : num  NA NA NA NA NA NA NA NA NA NA ...
  .. ..$ date     : chr  NA NA NA NA ...
  .. ..$ character: chr  "" "" "" "" ...

Please let me know if you need further information. My code also provoked this bug in RStudio 1.1.463, and also in the Preview Release Version you asked me to try in October 31th.

regards.

Any chance you can share some standalone R code that generates the data structure you're using that freezes in the viewer? (I suspect it's caused by the large data.frames contained within the data list)

Dear Kevin,

Please find below the code. Althought it works properly, if we try to View(dt_all_cells.nest) RStudio will hang severelly, forcing me to kiil the task via Windows.

Please let me know if you need something else.

Regards,

Fabio.

  library(unpivotr)

  library(tidyverse)

  library(tidyxl)

  library(data.table)

  library(stringi)

  library(purrr)

  library(ggplot2)

  library(RColorBrewer)

  source("C://Users//fabio//OneDrive//Machine Learning Datasets//textPreProcess//cleanText.R")

  ############## Leitura dos ddos

  read.file <- function(x) {

    out <- xlsx_cells(path = x)

    out$file <- x

    return(out)

  }

  pattern_file <- "agosto18.xl?"

  fpath <- "C://Users//fabio//OneDrive//Tecknowledge//ABSOLAR//Financiamento//CCEE-Res-Cons"

  xlsx.list <- list.files(path = fpath, pattern = pattern_file, full.names = T)

  dt_all_cells<-lapply(xlsx.list,read.file)

  dt_all_cells<-rbindlist(dt_all_cells)

  dt_all_cells <-

    dt_all_cells[, .(sheet, row, col, data_type, numeric, date, character,file)

                 ][data_type != "blank"

                   ][, date := strftime(date, "%Y-%m", tz = "GMT")

                     ]

  conv.utf8 <- function(x) {

    Encoding(x) <- "UTF-8"

    return(x)

  }

  dt_all_cells[, sheet := conv.utf8(sheet)][, character := conv.utf8(character)]

  ################     Escolha das tabelas

  dt_all_cells <- dt_all_cells[sheet %in% c("Resultado Consolidado"

                                            , "Resultado Comprador"

                                            , "REH 1.410_2013"

                                            , "Resultado Vendedor"

                                            ,"MDER")

                               ,]

  pattern_corner<- c("ID ")

  corners <- dt_all_cells[grepl(pattern_corner, character)

                          ][,c("numeric","date"):=NULL

                            ]

  ##########   Funcao que desconsidera radical repetido do nome das tabelas

  # gen.sheet.short.name <- function(x) {

  #   a<-substring(x, 1,4)

  #   anum <- as.numeric(a)*1

  #  if (!is.na(anum)) {

  #    out <- substr(x, 5, 1000)

  #  }

  #   else {

  #     out <- x

  #   }

  #   return(out)

  # }

  sn_function_sheet <- function (x){return (x)} ###### Antes era gen.sheet.short.name ()

  sn_function_tabela <- function (x){return (x)} ###### substr(character, 1,10)

  corners <- corners %>%

    mutate(sheet_sn = sn_function_sheet(sheet)) %>%

    mutate (tabela_sn = sn_function_tabela(character))

  dt_all_cells <- dt_all_cells %>%

    mutate(sheet_sn = sn_function_sheet(sheet))

  dt_all_cells.nest <- dt_all_cells %>%

    group_by(file, sheet_sn) %>%

    nest()

Sorry, but your example is not a minimally reproducible example.

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