posit-dev / posit-dev/positron
Feature request: Support cached copy in Data Explorer
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 4.3k
- Forks
- 184
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 195
Description
System details:
Positron Version: 2024.09.0 (Universal) build 27
Code - OSS Version: 1.92.0
Commit: d996153f3be6bcc9af460300e61103425323b973
Date: 2024-09-11T02:38:46.408Z
Electron: 30.1.2
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Darwin arm64 23.5.0
Interpreter details:
R 4.4
Describe the issue:
Copied from: https://github.com/posit-dev/positron/discussions/4658#discussion-7172981 via @brndngrhm
I often use
View()at the end of dplyr chains to quickly check my logic before assigning the output to an object.In Positron, I'm finding that once i execute a 2nd
View()command, the first one is no longer viewable (see below). I am used to being lazy and just comparing outputs across multiple View() statements without having to assign to objects, which i am able to do in R Studio but not in Positron.Is this capability something that can be added to Positron?
Steps to reproduce the issue:
library(tidyverse)
# View 1 - executing this opens the data pane showing mtcars (screenshot 1)
mtcars %>% View()
# View 2 - executing this opens a new data pane showing summarized mtcars (screenshot 2)
# - trying to go back to the first data pane results in a message: object no longer available (screenshot 3)
mtcars %>%
group_by(mpg) %>%
tally() %>%
View()
Expected or desired behavior:
comparing outputs across multiple View() statements without having to assign to objects, which i am able to do in R Studio but not in Positron.
Were there any error messages in the UI, Output panel, or Developer Tools console?
Per @jmcphers this is expected.
I think it's "sort of" intended. RStudio's data viewer makes a copy of everything you give it, so data viewer tabs can keep working if you remove the original copy. Positron's data viewer doesn't ever make copies; it only runs against the original object. A simpler repo case:
mt <- mtcars View(mt) rm(mt)In Positron this will result in your data viewer immediately going offline with the "object is no longer available" message, whereas in RStudio you can keep using the viewer.
Choosing to serve all requests from the original data (vs making a cached copy) was an intentional design decision that was made with the goal of keeping memory use under control (especially for big objects). But we could walk it back or fine tune it, especially for R (where copy-on-write can make most copies zero/low cost) and when the data is small.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the R View() reproductions in the issue and the Data Explorer behavior they demonstrate. Compare the current live-object approach with the requested cached-copy behavior, including the stated memory-use tradeoff. Done should mean earlier data views remain usable after later View() calls or removal of the original object.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r, typescript
- Domain
- data, frontend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100