Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RStudio takes a really loooong time to render (through View()) an sf object #12895

Open
4 tasks done
ramiromagno opened this issue Mar 23, 2023 · 12 comments
Open
4 tasks done

Comments

@ramiromagno
Copy link

ramiromagno commented Mar 23, 2023

System details

RStudio Edition : Desktop
RStudio Version : "Cherry Blossom" Release (3c53477a, 2023-03-09) for Ubuntu Bionic, Mozilla/5.0 (X11; Linux x86_64)  AppleWebKit/537.36 (KHTML, like Gecko) rstudio/2023.03.0+386 Chrome/108.0.5359.179 Electron/22.0.3 Safari/537.36
OS Version      : Arch Linux, kernel 6.2.8
R Version       : 4.2.3 (2023-03-15) -- "Shortstop Beagle"

Steps to reproduce the problem

  1. Download a map data set
  2. Import that data as an sf object
  3. Be brave and try to View() it!
  4. RStudio now takes minutes to show what is essentially a data frame of 357 rows by 19 columns. I can see that RStudio is busy because it is running at 100% in one my vCPUs. Eventually, it finishes.

(Also drawing Edzer's attention: @edzer)

library(sf)

# Downloads a 168.8 MB zip archive
download.file("https://ows.emodnet-seabedhabitats.eu/geoserver/emodnet_open/wfs?request=GetFeature&service=WFS&version=1.1.0&outputFormat=SHAPE-ZIP&typeName=emodnet_open:biogenic_substrate_2021", destfile = "biogenic_substrate_2021.zip")

# Unzip the file to a folder with the same name
unzip("biogenic_substrate_2021.zip", exdir = "biogenic_substrate_2021")

path <- "biogenic_substrate_2021/"
foo <- sf::read_sf(path)

# Watch RStudio taking a loooooong time to show this data frame
# NOTE: the data frame is only 357 rows by 19 columns. I understand
# that the last column `geometry` is the large bit but still I would
# not expect it to take so long to render.
# 
# This also affects how long the R console will take to respond to new commands,
# i.e. it also takes longer. (I think that until the View() finishes running
# everything else gets unresponsive)
View(foo)

sessionInfo()'s output:

# `sessionInfo()`'s output
R version 4.2.3 (2023-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux

Matrix products: default
BLAS:   /usr/lib/libblas.so.3.11.0
LAPACK: /usr/lib/liblapack.so.3.11.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] sf_1.0-12

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.10        pillar_1.9.0       compiler_4.2.3     profvis_0.3.7      class_7.3-21       tools_4.2.3        digest_0.6.31     
 [8] jsonlite_1.8.4     evaluate_0.20      lifecycle_1.0.3    tibble_3.2.1       pkgconfig_2.0.3    rlang_1.1.0        DBI_1.1.3         
[15] cli_3.6.1          rstudioapi_0.14    yaml_2.3.7         xfun_0.37          fastmap_1.1.1      e1071_1.7-13       knitr_1.42        
[22] dplyr_1.1.1        stringr_1.5.0      generics_0.1.3     vctrs_0.6.1        htmlwidgets_1.6.1  classInt_0.4-9     grid_4.2.3        
[29] tidyselect_1.2.0   glue_1.6.2         R6_2.5.1           fansi_1.0.4        rmarkdown_2.20     magrittr_2.0.3     htmltools_0.5.4   
[36] ellipsis_0.3.2     units_0.8-1        utf8_1.2.3         KernSmooth_2.23-20 proxy_0.4-27       stringi_1.7.12
  • I have read the guide for submitting good bug reports.
  • I have installed the latest version of RStudio, and confirmed that the issue still persists.
  • If I am reporting an RStudio crash, I have included a diagnostics report.
  • I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
@ramiromagno ramiromagno added bug new New incoming issues, ready for initial review. labels Mar 23, 2023
@ramiromagno ramiromagno changed the title RStudio takes a really loooong time to render (through View()) an sf object RStudio takes a really loooong time to render (through View()) an sf object Mar 23, 2023
@edzer
Copy link

edzer commented Mar 24, 2023

See also r-spatial/sf#1602 and references therein.

@ronblum
Copy link
Contributor

ronblum commented Mar 24, 2023

@ramiromagno Thank you for raising the issue! I can also reproduce this in

  • RStudio Desktop 2022.07.02 on MacOS 13.2
  • RStudio Server 2023.03.0-daily+92 on Ubuntu 20.04 via Chrome on MacOS 13.2

We'll review this as we continue to develop RStudio.

@ronblum ronblum added data viewer and removed new New incoming issues, ready for initial review. labels Mar 24, 2023
@FCalderoni
Copy link

Hi, sorry to pop out of the blue but I wanted to note that I am experiencing a similar issue with the View() command for opening basic dataframes and tibbles.
New workstation, fresh and updated R & RStudio install. Other tasks including loops and simulations are super fast, but View() takes something like 10''...

@github-actions
Copy link

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.

@github-actions github-actions bot added the stale Issues which have been closed automatically due to inactivitiy. label Oct 10, 2023
@olivroy
Copy link
Contributor

olivroy commented Oct 10, 2023

same issue for me.

I use

dat |> sf::st_drop_geometry() |> View()

to make it faster

@github-actions github-actions bot removed the stale Issues which have been closed automatically due to inactivitiy. label Oct 11, 2023
Copy link

github-actions bot commented Apr 8, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.

@github-actions github-actions bot added the stale Issues which have been closed automatically due to inactivitiy. label Apr 8, 2024
@ramiromagno
Copy link
Author

This is still the case with:

RStudio 2023.12.1+402 "Ocean Storm" Release (4da5832, 2024-01-29) for Ubuntu Focal
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) rstudio/2023.12.1+402 Chrome/116.0.5845.190 Electron/26.2.4 Safari/537.36

@github-actions github-actions bot removed the stale Issues which have been closed automatically due to inactivitiy. label Apr 9, 2024
@kevinushey
Copy link
Contributor

@ramiromagno can you please test with the latest daily builds, available at https://dailies.rstudio.com?

@ramiromagno
Copy link
Author

ramiromagno commented Apr 10, 2024

Hi Kevin (@kevinushey):

I just tried with 2024.04.0.daily.682. The issue persists (takes a few minutes to show the View pane).

snap

@edzer
Copy link

edzer commented Apr 10, 2024

Provided you have pkg lwgeom installed, does it persist after you set

Sys.setenv("LWGEOM_WKT"="true")

?
See also r-spatial/sf#2361

@ramiromagno
Copy link
Author

ramiromagno commented Apr 10, 2024

It goes away with Sys.setenv("LWGEOM_WKT"="true"), indeed!

It takes 10 seconds, instead of several minutes!

@kevinushey
Copy link
Contributor

Thanks @edzer! Is there anything special RStudio should be doing here when viewing sf objects, or is it the user's responsibility to set that environment variable?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants