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

Dynamic dataframe loading when using View() #837

Closed
danielbasso opened this issue Oct 24, 2021 · 7 comments
Closed

Dynamic dataframe loading when using View() #837

danielbasso opened this issue Oct 24, 2021 · 7 comments

Comments

@danielbasso
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Using View() on large dataframes causes the system to crash or become slow since it has to load all data into a html template.

Describe the solution you'd like
Use pagination to load only rows that are on screen. Filtering and sorting should be handled "server-side".

Describe alternatives you've considered
I use things like View(my_dataframe[1:100,]), but it compromises filtering and sorting.

Additional context

Example:

dataframe_size <- 5000000 # 5mi rows

my_dataframe <- data.frame(a = rnorm(dataframe_size),
                 b = rnorm(dataframe_size),
                 c = rnorm(dataframe_size),
                 d = rep("test", dataframe_size))

View(my_dataframe)

Screenshot:

image

I'd like to help/implement, if possible. I already took a look at vsc.R and session.ts since the Ag Grid update (#708). Tips/advice are welcomed.

@litn2018
Copy link

any update about this? it should be implemented as lazy loading, like RStudio implementation.

@eitsupi
Copy link
Contributor

eitsupi commented Feb 6, 2022

As a workaround, it is now possible to set the maximum number of rows to be loaded into the data viewer (#945).
In my environment, I think setting it to about 100,000 rows is comfortable to use.

image

@danielbasso
Copy link
Contributor Author

@eitsupi Had a huge problem with 2FA and almost lost my account. But I'm back.

Thank you for letting me know about the workaround. I've talked to @ElianHugh a while ago about this, and he gave me the idea of making the solution completly optional, to not disturb the current functionality.

I'm trying to find some time to delve into this issue.

@d-golzato
Copy link

d-golzato commented Jan 2, 2023

Hi, thanks a lot for your huge work on this extension. Vscode complete noob here!

I'm having troubles opening and working interactively with big dataframes (> 1,000,000 rows). The data viewer is quite slow at opening these dataframes and when it does, nothing is shown in the respective preview editor. For small
dataframes there are no particular problems.

I have enabled R:Session watcher and set the option Row limit to 50

Do you have any update about this feature/fix?

Thanks!

@danielbasso
Copy link
Contributor Author

Hi @d-golzato, how are you?

Unfortunately I couldn't delve further into this feature. Life got a little too busy since my first (and only) contribution to this project so far.

The main problem is that R commands can trigger Vscode events/actions/etc via writing on a file that is watched by the Vscode session; the other way around, as far as I know, it's not possible in the moment.

The only way to trigger R events/actions in the session is quite literally writing in the R console. I've managed to create a very crude solution some time ago that worked as follows:

  1. Ag grid requests a new page;
  2. Vscode, through the rTerminal 'class', literally writes in the console a command bound to slice a new chunk of data from the original dataframe;
  3. The result is written on a file, watched by Ag Grid, who them proceeds to update the frame with new data.

It worked, but the constant terminal calls were ugly and the overall approach felt cheap. I couldn't manage to find a elegant way to make the R calls invisible. Furthermore, I don't think that is the optimal approach to the problem: an websocket communication, as described in #1151, could provide nicer interactions between R and Vscode sessions and allow lots of new features.

Sorry about that.

Copy link

github-actions bot commented Jan 5, 2024

This issue is stale because it has been open for 365 days with no activity.

@github-actions github-actions bot added the stale label Jan 5, 2024
Copy link

This issue was closed because it has been inactive for 14 days since being marked as stale.

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

4 participants